flaiwheel

mcp
Security Audit
Warn
Health Warn
  • License — License: NOASSERTION
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Low visibility — Only 6 GitHub stars
Code Pass
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Pass
  • Permissions — No dangerous permissions requested

No AI report is available for this listing yet.

SUMMARY

Self-hosted engineering memory and governance for AI coding agents, backed by Markdown, Git and MCP.

README.md

Flaiwheel

flaiwheel MCP server
Available on Glama

A self-hosted knowledge layer for AI coding agents. Keep architecture decisions,
bug fixes, setup guidance and evidence in Git, then retrieve them through MCP and
the Web UI without making the knowledge repository part of the application repo.

Flaiwheel does not replace an AI coding assistant. It gives the assistant explicit
search, review and write workflows while keeping Markdown and Git as the canonical
knowledge store. Agent instructions can make those workflows habitual, but they do
not guarantee that every client will call every tool or document every task.

Contents

Quick start

Prerequisites

  • A running Docker environment.
  • A Git checkout for the project whose knowledge Flaiwheel will manage.
  • An authenticated GitHub CLI (gh auth login) or GitLab CLI (glab) for the
    source provider. The installer creates a separate private knowledge repository.
  • macOS or Linux; Windows is supported through WSL2. Docker Desktop with the
    WSL 2 backend is required for that path. Native PowerShell/CMD installation is
    not documented as a supported installer path.

Do not run the installer with sudo.

Local install (default)

Run from inside the project directory:

bash <(curl -sSL https://raw.githubusercontent.com/dl4rce/flaiwheel/main/scripts/install.sh)

Press Enter to select the new-install local profile. It serves HTTP on host
loopback ports 127.0.0.1:8080 (Web) and 127.0.0.1:8081 (MCP). The profile relies
on restricted Docker host publications; local Web requests are not challenged with
credentials, so do not publish an unauthenticated local instance to a LAN or the
Internet.

The installer can create the knowledge repository, start Flaiwheel, configure
supported MCP clients, and install the optional post-commit hook. Review the files
it proposes before accepting them. After installation, open http://127.0.0.1:8080
and verify the selected project, then confirm the MCP registration in your client.

For GitLab, authenticate glab and select the provider when required. For a
self-managed host, set FLAIWHEEL_GIT_PROVIDER=gitlab as described in
GitHub and GitLab projects.

Remote install (explicit)

Remote mode requires native HTTPS, restricted firewall exposure, certificate trust,
and a shared bearer. Choose it deliberately; the installer does not infer that a
machine can safely be exposed remotely.

FLAIWHEEL_CONNECTION_MODE=remote \
FLAIWHEEL_REMOTE_HOST=flaiwheel.example.com \
FLAIWHEEL_REMOTE_TLS=private-ca \
  bash <(curl -sSL https://raw.githubusercontent.com/dl4rce/flaiwheel/main/scripts/install.sh)

Alternatively, provide a certificate with
FLAIWHEEL_REMOTE_TLS=certificate. Private keys, bearer delivery, CA identity and
client trust are operator responsibilities. See
Connection profiles and remote deployment
for the complete setup and verification procedure. Generated configuration alone
does not prove connectivity.

What the local default installs

The default installer:

  1. Detects the project and source provider from the Git remote.
  2. Creates or connects a separate knowledge repository and registers the project.
  3. Starts one Docker service with persisted /data and /docs volumes.
  4. Writes supported client configuration where the relevant client is installed.
  5. Installs project guidance and can add a post-commit hook for selected conventional
    commit prefixes (fix:, feat:, refactor:, perf:, docs:).
  6. Opens a setup path for classifying existing project documentation.

Restart the client if its MCP integration does not appear immediately. The Web
Connection guide contains client-specific snippets and the authoritative profile
summary.

Current release: v3.22.1

The current patch release, v3.22.1, keeps the v3.22 task-focused feature set
while making the Web UI, homepage and GitHub onboarding easier to scan:

  • Needs attention first: Knowledge Health starts from a bounded attention queue;
    full text, evidence and history are opened on demand, up to 25 UI rows per page.
  • Project learning: a destination project explicitly selects currently available
    bugfix sources. Learning is direct, read-only, non-transitive and source-opted-in.
  • System information: stable subjects and environments group explicit assertions;
    competing values and unverified status remain visible.
  • Progressive connection setup: transport, authentication and address are shown
    first, with client, certificate and troubleshooting instructions available later.
  • Evidence-led impact: search activity, assessed task reuse, reported CI findings,
    optional effort ranges and signed duration differences remain separate. A search hit
    does not imply time saved or a regression prevented.
  • Faster navigation: the Web UI keeps Search and governance tasks primary while
    exposing project health, version, synchronization and Operations in the top
    workspace bar. Search scope/history controls remain one closed disclosure.
  • Clearer first impression: the public site puts installation earlier and the
    README puts Quick Start, data boundaries and current behavior before history.

See CHANGELOG.md for the complete release history and the
v3.22.1 release for the
release artifact. The current Whitepaper v1.8 is available as
PDF and
editable DOCX.

Platforms and boundaries

Supported deployment paths

  • macOS and Linux: installer-supported hosts with Docker.
  • Windows: use WSL2 and Docker Desktop with its WSL 2 backend.
  • Remote clients: supported when the operator supplies a reachable address,
    TLS, authentication, firewall policy and client trust; generated snippets are not
    proof of a successful handshake.

Flaiwheel is one self-hosted Docker service with Web and MCP interfaces. A single
instance can register multiple projects and Git providers, but project scoping is
not tenant isolation or a per-user authorization boundary. Anyone already authorized
to operate the instance can use its existing administrative capabilities unless an
operator adds controls outside Flaiwheel.

Product boundaries

  • Flaiwheel provides structured retrieval and review workflows; it does not verify that
    a statement is true merely because it is stored, timestamped or proposed by an agent.
  • Human confirmation routes and administrator Basic authentication identify the
    configured review workflow. They do not independently prove the identity or intent
    of a person using the credentials.
  • Project-local relationship and impact traversal is explicitly bounded. It is not an
    autonomous infrastructure inventory, entity resolver or graph database.
  • Search, pagination and model hot-swap improve usability; no universal retrieval,
    latency, uptime or organization-scale result is guaranteed.
  • Quality checks and gitleaks policy can reject or flag writes when configured, but
    external MCP clients still decide whether and how to invoke Flaiwheel tools.

What Flaiwheel stores and sends

Self-hosting is a deployment choice, not a claim of zero network activity:

  • The canonical knowledge documents, Git metadata and review history live in each
    project's knowledge repository. Derived indexes, configuration, project state,
    certificates and event-level telemetry live under the persisted service volumes.
  • Flaiwheel connects to the configured Git remote to pull and, when enabled, push.
    Credentials remain an operator-controlled input and Git repositories can be
    private or remote.
  • The default embedding provider is local, but model files may be downloaded on first
    use and cached by the service. Selecting the optional OpenAI provider sends
    embedding input to that external service instead.
  • A remote deployment necessarily sends Web/MCP traffic over the selected network.
    Local mode avoids that remote service exposure only when both Docker publications
    remain on host loopback.
  • Optional webhook, Open Terminal, GitHub, GitLab and client integrations add their
    own network and credential flows.

Do not publish real internal addresses, customer/project names, credentials, private
keys or operational logs in reusable documentation. Generic examples and generic
privacy statements are intentional; deployment owners must review their own policy,
retention and backup requirements.

Core capabilities

  • Hybrid semantic + BM25 search, optional cross-encoder reranking and incremental
    reindexing across supported document formats.
  • MCP tools for search, file/session context, structured documentation, project
    management, review history, relations, temporal facts and task-impact assessment.
  • A Web UI for project administration, search, connection guidance, attention-first
    Knowledge Health, directional project learning, system information and settings.
  • Git synchronization for GitHub.com, GitLab.com and explicitly configured
    self-managed GitLab repositories, with separate per-project credentials.
  • Revision-bound review assistance, explicit source provenance and structured Markdown
    frontmatter while preserving Git history as the canonical audit trail.

Updating

Run the same install command again from your project directory:

bash <(curl -sSL https://raw.githubusercontent.com/dl4rce/flaiwheel/main/scripts/install.sh)

The installer detects the existing container, asks for confirmation, then:

  • Verifies the target host ports are actually free before touching anything (and refuses if a non-Flaiwheel process owns them)
  • Rebuilds the Docker image with the latest code before stopping the old container, so a failed build is not an outage
  • Recreates the container, preserving both volumes (/data and /docs), the host port bindings, and all MCP_* settings
  • Refreshes all agent configs and guides

Your knowledge base, index, and credentials are preserved — only the code is updated.

Shared hosts, custom ports, and proxies

If 8080/8081 are already taken (e.g. by a fronting proxy), point the installer at free ports instead of fighting over the defaults:

FLAIWHEEL_WEB_PORT=18080 FLAIWHEEL_SSE_PORT=18081 \
FLAIWHEEL_WEB_BIND=127.0.0.1 FLAIWHEEL_SSE_BIND=127.0.0.1 \
  bash <(curl -sSL https://raw.githubusercontent.com/dl4rce/flaiwheel/main/scripts/install.sh)
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 127.0.0.1 local / 0.0.0.0 new remote Web host publication; updates preserve existing bindings
FLAIWHEEL_SSE_BIND 127.0.0.1 local / 0.0.0.0 new remote MCP host publication; local requires 127.0.0.1
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.

Host ports: the generated client URLs follow the selected published ports. Container listener ports remain separate. Existing deployments preserve their publications.


Manual Setup

Click to expand manual steps

Project names, task IDs, hostnames and example paths below are fictional or generic placeholders. Use reserved example domains/documentation address ranges in public examples, never real internal deployment identifiers, customer names or operational logs. Product defaults such as loopback addresses and /data describe the software contract, not a particular installation.

1. Create a knowledge repo

# On GitHub, create: <your-project>-knowledge (private repo)
mkdir -p architecture api bugfix-log best-practices setup changelog
echo "# Project Knowledge Base" > README.md
git add -A && git commit -m "init" && git push

2. Build and start Flaiwheel

git clone https://github.com/dl4rce/flaiwheel.git /tmp/flaiwheel-build
docker build -t flaiwheel:latest /tmp/flaiwheel-build

# Smoke-test the image BEFORE starting or replacing a container.
# A broken transitive dependency only surfaces on a fresh resolve, so an
# image can build cleanly and still fail every import at runtime.
docker run --rm --entrypoint sh flaiwheel:latest -c \
  'python -c "from flaiwheel.server import create_mcp_server; import flaiwheel; print(flaiwheel.__version__)"'

docker run -d --init \
  --name flaiwheel \
  -p 127.0.0.1:8080:8080 \
  -p 127.0.0.1:8081:8081 \
  -e MCP_CONNECTION_MODE=local \
  -e MCP_GIT_REPO_URL=https://github.com/you/yourproject-knowledge.git \
  -e MCP_GIT_TOKEN=ghp_your_token \
  -v flaiwheel-data:/data \
  flaiwheel:latest

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.

Run the service with Docker --init (or Compose init: true) to reap orphaned
children. Existing containers must be recreated to enable it. After three failed
pushes, retries back off exponentially up to one hour; health details show the
failure count and next_push_retry_at (remote: authenticated /api/health;
legacy/local: /health?project=NAME). Changes continue to be committed
locally during the delay and are retried later; do not discard the volumes.
Setup checks remote reachability and performs a noninteractive push dry-run, but
success does not prove write access or that a remote is not archived: a
no-op dry-run may not exercise authorization or server hooks.

On Linux, /health includes zombie_count for the processes visible in the
container's PID namespace (null if unavailable); 500 or more logs a warning.
This is not a host-wide metric. Monitor host zombie counts separately. An init
can reap adopted orphans, but cannot reap a live process's children for it.

3. Connect your AI agent (local HTTP examples)

Cursor — add to .cursor/mcp.json:

{
  "mcpServers": {
    "flaiwheel": {
      "type": "sse",
      "url": "http://localhost:8081/sse"
    }
  }
}

VS Code / GitHub Copilot (1.99+) — add to .vscode/mcp.json:

{
  "servers": {
    "flaiwheel": {
      "type": "sse",
      "url": "http://localhost:8081/sse"
    }
  }
}

Then: Command Palette → MCP: List Servers → start flaiwheel.

Claude Desktop (macOS app) — add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "flaiwheel": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "http://localhost:8081/sse"]
    }
  }
}

Requires Node.js. Restart Claude for Mac after editing.

Claude Code CLI — run once in your project directory:

claude mcp add --transport sse --scope project flaiwheel http://localhost:8081/sse

GitHub and GitLab projects side by side

One instance can sync GitHub and GitLab knowledge repositories simultaneously. In Add Project or Git Sync, enter the repository URL, provider and that project's token. auto recognizes exactly github.com and gitlab.com; select gitlab explicitly for a self-managed GitLab host. Nested namespaces such as https://git.example.com/team/subgroup/knowledge.git are supported.

For GitLab HTTPS, use a personal/project access token with read_repository for pull-only access or write_repository for auto-push. The default HTTPS username is oauth2; supply the issued username for deploy tokens (read-only Git access). Use HTTPS for token authentication. SSH remotes use Git's existing SSH configuration; the HTTPS token is not applied to SSH and credentials/known hosts must be available inside the service.

Synchronization uses periodic Git pull; this change does not add GitLab webhooks or GitLab CI templates. Switching a configured repository URL does not migrate an existing checkout: add a separate project for a different repository.

Runtime settings are MCP_GIT_PROVIDER=auto|github|gitlab, MCP_GIT_USERNAME (optional), and MCP_GIT_TOKEN. Per-project settings override them; a global token is inherited only for repositories on the same origin (scheme, hostname and port), never across different GitHub/GitLab origins. Prefer separate per-project credentials. Tokens are passed through repository-scoped Git subprocess configuration, not embedded in newly cloned remote URLs. Existing credential-bearing remotes are not migrated automatically.

For installation from a GitLab source checkout, install GitLab CLI (glab) and authenticate to the source host first:

glab auth login --hostname gitlab.example.com
FLAIWHEEL_GIT_PROVIDER=gitlab bash <(curl -sSL https://raw.githubusercontent.com/dl4rce/flaiwheel/main/scripts/install.sh)

The installer creates a private knowledge repository in the source namespace, including nested groups. Its CLI credential needs API access and permission to create projects and push; these are broader permissions than an existing repository's runtime token requires. Existing GitHub installations keep their GitHub path. Flaiwheel's software download source remains GitHub regardless of the knowledge provider.

3b. Connection profiles and remote deployment

Profile Web / MCP Authentication / exposure
local (new installer default) HTTP, ports 8080 / 8081 Host publications must be 127.0.0.1; local Web requests are trusted without credentials
remote (explicit) Native HTTPS on both ports Shared bearer for MCP and Web UI/API; Web also accepts admin Basic auth; minimal /health is public
legacy (unset raw runtime default) Existing TLS/HTTP behavior Existing authentication and exposure retained, not upgraded automatically

Local is a deployment boundary, not a peer-IP detector. Docker requests can
arrive from a bridge/gateway address. Local mode does not infer safety from that
address or enforce loopback at the application layer. Manual Docker deployments
must publish both ports with -p 127.0.0.1:8080:8080 and
-p 127.0.0.1:8081:8081; do not use host networking, public publications or a
forwarding proxy to expose an unauthenticated local instance. The internal
MCP_SSE_HOST=0.0.0.0 listener is normal for Docker. The MCP Host/Origin allowlist
is DNS-rebinding protection, not a substitute for restricted publications,
TLS or authentication.

New remote install: choose private CA or supply a certificate

On the Docker host, run the installer in your project and explicitly select
remote, then enter the DNS name or IPv4 address clients will use (no scheme or
port). The equivalent new-install private-CA selection is:

FLAIWHEEL_CONNECTION_MODE=remote \
FLAIWHEEL_REMOTE_HOST=flaiwheel.example.com \
FLAIWHEEL_REMOTE_TLS=private-ca \
  bash <(curl -sSL https://raw.githubusercontent.com/dl4rce/flaiwheel/main/scripts/install.sh)

This generates a private CA and server certificate in persistent /data/tls.
Every client must trust that CA. Alternatively set
FLAIWHEEL_REMOTE_TLS=certificate and
FLAIWHEEL_TLS_SOURCE=/absolute/path/to/certificate-directory. That directory
must contain server.crt (full chain, not just the leaf) and server.key;
the installer mounts it read-only. Obtain and renew those files through your own
CA process. Flaiwheel does not provision public ACME certificates or configure
Caddy. In either case the certificate must cover the client hostname/IP.

Remote serves https://flaiwheel.example.com:8080 for Web and
https://flaiwheel.example.com:8081/sse for MCP (or your chosen host ports).
The existing Web port 8080 becomes HTTPS, not a new port. Update bookmarks,
API callers, monitoring and MCP URLs; plain HTTP no longer works on those
remote listeners. TLS/configuration failures abort startup rather than falling
back to HTTP. Restrict firewall access to intended clients even with TLS/auth.

For a manual remote deployment, preserve your data/docs mounts and supply:

-e MCP_CONNECTION_MODE=remote \
-e MCP_EXTERNAL_WEB_URL=https://flaiwheel.example.com:8080 \
-e MCP_EXTERNAL_MCP_URL=https://flaiwheel.example.com:8081/sse \
-e MCP_MCP_AUTH_REQUIRED=true \
-e MCP_SSE_ALLOWED_HOSTS=flaiwheel.example.com \
-e MCP_SSE_TLS_AUTO=true

Use those flags with docker run, not as standalone commands. For supplied
certificates replace MCP_SSE_TLS_AUTO=true with both
MCP_SSE_TLS_CERTFILE=/certs/fullchain.pem and
MCP_SSE_TLS_KEYFILE=/certs/privkey.pem, plus a read-only certificate mount.
Remote requires SSE, valid HTTPS external URLs, native TLS and bearer auth.
External URL settings advertise client endpoints; they do not configure DNS,
port publication or certificate trust. Keep
MCP_SSE_DNS_REBINDING_PROTECTION=true; allowlist the actual host, not *.
FASTMCP_HOST is not a replacement for MCP_SSE_HOST or the allowlist.

Deliver the bearer privately

The bearer is generated once and reused from
MCP_MCP_TOKEN_FILE (default /data/secrets/mcp-token). It must be an owned,
regular, owner-only file (0600), with no symlink path components. Persist
/data; recreating an empty data volume loses both credentials and CA trust.
The bearer is not returned in connection metadata or printed in the installer
summary. Treat it as a shared administrator-level credential, not a per-user or
read-only token.

On a trusted administrator host, export it without printing its value:

umask 077
docker cp flaiwheel:/data/secrets/mcp-token ./flaiwheel-mcp-token
chmod 600 ./flaiwheel-mcp-token

Use authenticated SSH/SCP or a secret manager to deliver it only to authorized
clients; keep destination files owner-only and outside tracked repositories.
Never paste the token into project JSON, URLs, screenshots, logs or shell
history. Use the client's secret store or supported secret/environment
reference for Authorization: Bearer <secret>. VS Code's generated config uses
a masked input prompt; Cursor references ${env:FLAIWHEEL_MCP_TOKEN}, while
Claude Code's root .mcp.json uses ${FLAIWHEEL_MCP_TOKEN}. Provision the
variable in the actual client's environment and verify its supported syntax.
When registering a CLI header, single-quote the literal placeholder so the
shell does not expand the secret into persisted project configuration.
A shell can load that variable without echoing the secret:

export FLAIWHEEL_MCP_TOKEN="$(cat ./flaiwheel-mcp-token)"

Environment inheritance differs for GUI clients; launching an IDE from a shell
is not proof that its MCP process received the secret. Ensure the header is
sent on both the SSE GET and message POST/reconnect requests. Web accepts
the same bearer or the administrator's Basic credentials over HTTPS. Remote
has no loopback, Docker-peer or forwarded-header authentication bypass.

Verify CA identity, install trust, then verify the client

The installer exports the public CA to $HOME/.flaiwheel/ca.pem
(FLAIWHEEL_CLIENT_CA_PATH overrides this). Web's authenticated Connection
guide also exposes the public CA and its SHA-256 certificate fingerprint; it
never downloads private keys or the bearer. For first contact, obtain the CA
through authenticated SSH/admin access rather than bypassing an untrusted HTTPS
warning. Copy only ca.pem, never ca.key or server.key.

Compare this fingerprint on the client with the server's fingerprint obtained
through a separately trusted administrative channel before trusting it:

openssl x509 -in "$HOME/.flaiwheel/ca.pem" -noout -fingerprint -sha256

Install the verified CA in the trust store actually used by each client.
For direct Cursor/Electron and VS Code SSE connections, use the operating-system
trust store; an env object in a direct SSE entry does not establish trust.
On macOS, for the current user's login keychain:

security add-trusted-cert -r trustRoot \
  -k "$HOME/Library/Keychains/login.keychain-db" \
  "$HOME/.flaiwheel/ca.pem"

On Linux/Windows, use the approved OS/client root-certificate installation
procedure. Stdio adapters such as mcp-remote launch a child process and may use
NODE_EXTRA_CA_CERTS=/absolute/path/to/ca.pem for that process instead.
Fully restart the client after trust changes. Supplied public-CA certificates
need a complete chain and an already trusted issuer; internal-CA certificates
need their issuing CA trusted too. Never use curl -k,
NODE_TLS_REJECT_UNAUTHORIZED=0 or disabled certificate validation as a fix.

Verify HTTPS and authentication without insecure overrides; an unauthenticated
request to Web UI/API or MCP should return 401, not bypass authentication.
The public remote /health probe returns only status, version and
zombie_count; use authenticated /api/health for detailed project/Git metrics. Then configure the
secret header in the actual IDE/client and complete an MCP initialization and
tool call. An exported CA, a generated config or an open Web page alone does
not prove MCP readiness. SSE remains open, so a diagnostic curl can time out
after receiving a valid stream; that alone is not an MCP handshake.

Existing deployments and migration

An ordinary installer update preserves the existing connection mode,
MCP_* settings, host publications and certificate mounts. An unset mode stays
legacy even if it historically served LAN HTTP. This is compatibility, not a
claim that the old exposure is safe. Remote cannot silently downgrade to HTTP;
FLAIWHEEL_TLS_AUTO=0 is rejected for an existing remote profile.

Changing profile is an explicit deployment recreation, not a Web UI toggle
and not a normal installer update with a different selection. Back up /data
and /docs, record all environment values, mounts and published bindings,
stop/retain the previous container for rollback, then recreate with the desired
profile and complete configuration using the same persistent volumes.
For local, restrict both host publications to 127.0.0.1; for remote, supply
TLS, required auth, external HTTPS URLs and the hostname allowlist above.
Validate the new endpoints, trust and real client handshake before removing
the rollback container. Keep private keys and bearer files in backups protected
like credentials. The Connection guide reports setup information; it does not
republish Docker ports, install client trust or switch the running listeners.

The remote post-commit hook uses FLAIWHEEL_TOKEN_FILE and optional
FLAIWHEEL_CA_FILE in the gitignored .cursor/flaiwheel-hook.conf.
The installer exports an owner-only bearer copy to
$HOME/.flaiwheel/<container-name>/mcp-token; configuration stores paths only.
The hook requires HTTPS when a token is configured, verifies the server with
the specified CA or system trust, and supplies the bearer through curl config
on stdin rather than exposing it in process arguments. If export fails,
configure the private token file before relying on capture. Existing hooks need
the updated script/configuration; an old unauthenticated hook is not sufficient.

4. Done. Start coding.


Knowledge Repo Structure

yourproject-knowledge/
├── README.md              ← overview / index
├── architecture/          ← system design, decisions, diagrams
├── api/                   ← endpoint docs, contracts, schemas
├── bugfix-log/            ← auto-generated bugfix summaries
│   └── 2026-02-25-fix-payment-retry.md
├── best-practices/        ← coding standards, patterns
├── setup/                 ← deployment, environment setup
├── changelog/             ← release notes
└── tests/                 ← test cases, scenarios, regression patterns

Supported Input Formats

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 .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.


Configuration

Runtime configuration uses environment variables (MCP_ prefix), supported Web UI settings, or a runtime .env file. Web is http://127.0.0.1:8080 for local and https://<host>:8080 for remote. Connection/TLS/publication changes require explicit deployment recreation, not a UI toggle.

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_CONNECTION_MODE legacy Raw runtime default for compatibility; new installer selects local, explicit remote requires TLS/auth
MCP_EXTERNAL_MCP_URL Advertised MCP URL; required HTTPS URL in remote, including /sse
MCP_EXTERNAL_WEB_URL Advertised Web URL; required HTTPS URL in remote
MCP_MCP_AUTH_REQUIRED false Shared bearer authentication; must be true in remote
MCP_MCP_TOKEN_FILE /data/secrets/mcp-token Persistent owner-only bearer file, never the token value
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 full chain; with the key, native HTTPS for MCP and also Web in remote mode
MCP_SSE_TLS_KEYFILE PEM private key. TLS is all-or-nothing: set both or neither
MCP_SSE_TLS_AUTO false Generate a persistent private CA + certificate when no pair is supplied. Remote requires this or a supplied pair; clients must establish CA trust
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

Multi-Repo Support

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:

  • The first install.sh run creates the Flaiwheel container with project A
  • Subsequent install.sh runs from other project directories detect the running container and register the new project via the API — no additional containers
  • All MCP tools accept an optional project parameter (e.g., search_docs("query", project="my-app"))
  • Call set_project("my-app") at the start of every conversation to bind all subsequent calls to that project (sticky session)
  • Without an explicit project parameter, the active project (set via set_project) is used; if none is set, the first project is used
  • The Web UI has a project selector dropdown to switch between projects
  • Use list_projects() via MCP to see all registered projects (shows active marker)

Adding/removing projects:

  • Via AI agent: call setup_project(name="my-app", git_repo_url="...") — registers, clones, indexes, and auto-binds
  • Via install script: run install.sh from a new project directory (auto-registers)
  • Via Web UI: click "Add Project" in the project selector bar
  • Via API: POST /api/projects with {name, git_repo_url, git_branch, git_token}
  • Remove: DELETE /api/projects/{name} or the "Remove" button in the Web UI

Backward 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.

Embedding Model Hot-Swap

When you change the embedding model via the Web UI, Flaiwheel re-embeds documents
in the background using a shadow collection. Search uses the old index while the
migration runs, then the application switches indexes after completion. Runtime,
resource or failure conditions can still interrupt service; this is not an uptime
guarantee.

The Web UI shows a live progress bar with file count and percentage. You can cancel at any time.

Embedding Models (local)

Model Approx. RAM Intended use
all-MiniLM-L6-v2 90MB Lower-memory English/general retrieval
nomic-ai/nomic-embed-text-v1.5 520MB General English retrieval
BAAI/bge-m3 2.2GB Multilingual retrieval

Select via Web UI or MCP_EMBEDDING_MODEL env var. Full list in the Web UI.

Cross-Encoder Reranker (optional)

The reranker is a second-stage model that rescores top candidates from hybrid
search. It reads the full (query, document) pair and can improve ordering for
vocabulary-mismatch queries, but its benefit depends on the corpus and workload.

How it works:

  1. Hybrid search (vector + BM25) retrieves a wider candidate pool (top_k × 5)
  2. RRF merges and ranks the candidates
  3. The cross-encoder rescores the top candidates and returns only the best top_k

Enable via Web UI (Search & Retrieval card) or environment variable:

docker run -d \
  -e MCP_RERANKER_ENABLED=true \
  -e MCP_RERANKER_MODEL=cross-encoder/ms-marco-MiniLM-L-6-v2 \
  ...
Reranker Model Approx. RAM Relative cost
cross-encoder/ms-marco-MiniLM-L-6-v2 90MB Lower
cross-encoder/ms-marco-MiniLM-L-12-v2 130MB Medium
BAAI/bge-reranker-base 420MB Higher

The reranker is off by default, avoiding model load and reranking work. When
enabled, it adds latency and resource use; evaluate its quality benefit on your own
queries rather than assuming a fixed percentage improvement.

GitHub Webhook (instant reindex)

Instead of waiting for the 300s polling interval, configure a GitHub webhook for instant reindex on push:

  1. In your knowledge repo on GitHub: Settings → Webhooks → Add webhook
  2. Payload URL: use your deployment URL plus /webhook/github (remote: https://your-server:8080/webhook/github)
  3. Content type: application/json
  4. Secret: set the same value as MCP_WEBHOOK_SECRET
  5. Events: select "Just the push event"

The webhook endpoint verifies the HMAC signature if MCP_WEBHOOK_SECRET is set. In remote mode transport authentication also protects this route; GitHub's standard webhook configuration cannot supply the shared bearer header. Do not expose an unauthenticated exception: use an authenticated relay or polling. In local/legacy mode, do not expose the endpoint without authentication and a webhook secret.

Impact evidence and CI guardrail telemetry

Keep observed activity separate from task assessments and reported CI outcomes:

  • GET /api/impact?project=<name>&days=30 — activity, assessed reuse/coverage, optional effort ranges, reported findings and duration differences
  • POST /api/impact/tasks?project=<name> — explicitly register a stable task ID; searches do not register tasks
  • POST /api/impact/assessments?project=<name> — record or correct an agent-reported task assessment; /api/impact/assessments/human requires administrator Basic credentials for explicit human confirmation
  • POST /api/impact/ci-reports?project=<name> — report CI findings, optionally linked to a stable task ID for task-level deduplication
  • Legacy compatibility: /api/impact-metrics and /api/telemetry/ci-guardrail-report remain available. Unsupported time-saved/regressions-avoided estimates are null; unlinked legacy CI reports remain reported observations, not confirmed prevented regressions

An effort range is an explicit assessment, never a reward for searches, result relevance or CI violations. Baseline-minus-actual durations are reported separately, including negative differences; they are not added to estimated effort avoided. See Impact methodology for request examples, attribution, deduplication, coverage and limitations.

Legacy CI report example (reported values, not independently verified outcomes):

Example payload:

{
  "project": "my-app",
  "violations_found": 4,
  "violations_blocking": 1,
  "violations_fixed_before_merge": 2,
  "cycle_time_baseline_minutes": 58,
  "cycle_time_actual_minutes": 43,
  "pr_number": 127,
  "branch": "feature/payment-fix",
  "commit_sha": "abc1234",
  "source": "github-actions"
}

Flaiwheel persists telemetry on disk (<vectorstore>/telemetry) so metrics survive container restarts and updates.

Diff-aware Reindexing

Reindexing is incremental by default: files whose extracted content has not changed
are not re-embedded. Elapsed time still depends on catalog size, changed files,
models and the host.

Use reindex(force=True) via MCP or the Web UI "Reindex" button to force a full rebuild (e.g. after changing the embedding model).


Architecture

┌─────────────────────────────────────────────────────────────┐
│  Docker Container (single process, N projects)               │
│                                                              │
│  ┌───────────────────────────────────────────────────────┐  │
│  │  Web-UI (FastAPI)                        Port 8080    │  │
│  │  Project CRUD, config, monitoring, search, health     │  │
│  └─────────────────────┬─────────────────────────────────┘  │
│                         │ shared state (ProjectRegistry)     │
│  ┌─────────────────────┴─────────────────────────────────┐  │
│  │  MCP Server (FastMCP)                    Port 8081    │  │
│  │  MCP tools (search, write, classify, manage,         │  │
│  │             review, relations, timeline)             │  │
│  └─────────────────────┬─────────────────────────────────┘  │
│                         │                                    │
│  ┌─────────────────────┴─────────────────────────────────┐  │
│  │  Shared Embedding Model (1× in RAM)                   │  │
│  └─────────────────────┬─────────────────────────────────┘  │
│                         │                                    │
│  ┌──────────────────────┴────────────────────────────────┐  │
│  │  Per-Project Contexts (scoped, not tenants)           │  │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐   │  │
│  │  │  Project A  │  │  Project B  │  │  Project C  │   │  │
│  │  │  collection │  │  collection │  │  collection │   │  │
│  │  │  watcher    │  │  watcher    │  │  watcher    │   │  │
│  │  │  lock       │  │  lock       │  │  lock       │   │  │
│  │  │  health     │  │  health     │  │  health     │   │  │
│  │  │  quality    │  │  quality    │  │  quality    │   │  │
│  │  └─────────────┘  └─────────────┘  └─────────────┘   │  │
│  └───────────────────────────────────────────────────────┘  │
│                                                              │
│  /docs/{project}/  ← per-project knowledge repos             │
│  /data/            ← shared vectorstore + config + projects  │
└─────────────────────────────────────────────────────────────┘

Search Pipeline

query
  │
  ├──► Vector Search (ChromaDB/HNSW, cosine similarity)
  │         fetch top_k (or top_k×5 if reranker enabled)
  │
  ├──► BM25 Keyword Search (bm25s, English stopwords)
  │         fetch top_k (or top_k×5 if reranker enabled)
  │
  ├──► RRF Fusion (configurable k, vector/BM25 weights)
  │         merge + rank candidates
  │
  ├──► [optional] Cross-Encoder Reranker
  │         rescore (query, doc) pairs for higher precision
  │
  ├──► Min Relevance Filter (configurable threshold)
  │
  └──► Return top_k results with relevance scores

Web UI

Access at http://127.0.0.1:8080 for local mode or https://:8080 for remote. Remote requires administrator Basic credentials or the shared bearer; local mode relies on restricted host publications. See the Connection guide for client setup; it is not a deployment-mode toggle.

Features:

  • System health panel: last index, last git pull, git commit, version, search metrics, quality score, skipped files count
  • Index status and statistics (including reranker status)
  • Embedding model selection (visual picker)
  • Search & Retrieval tuning: cross-encoder reranker toggle + model picker, RRF weights, minimum relevance threshold
  • Chunking strategy configuration
  • Git sync settings (URL, branch, auto-push toggle)
  • Test search interface
  • Knowledge quality checker (also runs automatically after every reindex)
  • Search metrics (hits/total, miss rate, per-tool breakdown)
  • Skipped files indicator (files excluded from indexing due to critical quality issues)
  • "This is the Way" — Knowledge Bootstrap: agent-driven project classification + in-repo cleanup (Web UI shows guidance + advanced scan)
  • Multi-project switcher (manage multiple repos from one instance)
  • Compact Connection guide summary with client-specific setup/details on demand; generated snippets are not a successful-handshake claim
  • Knowledge Health attention queue with bounded pages, on-demand evidence/history and revision-bound administrator review
  • Per-project learning checklist with explicit source opt-in and current-source selection, not automatic future-project access
  • Current system information cards with guided entry, competing assertions and explicit verification status
  • Impact panel separating observed activity, assessed task reuse/coverage, illustrative effort ranges and reported CI findings
  • Password management

Development

# Clone
git clone https://github.com/dl4rce/flaiwheel.git
cd flaiwheel

# Install
pip install -e ".[dev]"

# Run the standard test suite
pytest

# Run locally (needs /docs and /data directories)
mkdir -p /tmp/flaiwheel-docs /tmp/flaiwheel-data
MCP_DOCS_PATH=/tmp/flaiwheel-docs MCP_VECTORSTORE_PATH=/tmp/flaiwheel-data python -m flaiwheel

Optional: Open Terminal Local Daemon (Open WebUI)

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.

One-liner install via curl (no git clone)

Use main or pin a commit SHA / tag in the URL for reproducible bytes.

Linux / WSL2 (systemd --user):

curl -fsSL -o install-open-terminal-systemd-user.sh \
  https://raw.githubusercontent.com/dl4rce/flaiwheel/main/scripts/install-open-terminal-systemd-user.sh
/bin/chmod +x install-open-terminal-systemd-user.sh
/bin/bash ./install-open-terminal-systemd-user.sh

macOS (LaunchAgent; do not use sudo):

curl -fsSL -o install-open-terminal-launchagent.sh \
  https://raw.githubusercontent.com/dl4rce/flaiwheel/main/scripts/macos/install-open-terminal-launchagent.sh
/bin/chmod +x install-open-terminal-launchagent.sh
/bin/bash ./install-open-terminal-launchagent.sh

If chmod or bash are “not found”, your PATH is broken (often Conda base); the /bin/… paths above still work.

Linux / WSL2 (systemd --user)

./scripts/install-open-terminal-systemd-user.sh
  • Service name: com.flaiwheel.open-terminal-local.service
  • Default endpoint: http://localhost:8000
  • The script auto-generates an API key and prints it after install/reset.
  • On WSL2, make sure systemd=true is enabled in /etc/wsl.conf.

Useful commands:

systemctl --user status com.flaiwheel.open-terminal-local.service
journalctl --user -u com.flaiwheel.open-terminal-local.service -f

macOS (launchctl LaunchAgent)

./scripts/macos/install-open-terminal-launchagent.sh
  • LaunchAgent label: com.flaiwheel.open-terminal-local
  • Default endpoint: http://localhost:8000
  • The script auto-generates an API key and prints it after install/reset.
  • The LaunchAgent sets WorkingDirectory to $HOME by default so Open Terminal does not start in /private/tmp.
  • PATH: 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.
  • Persisted custom folder: the installer can save a path in ~/.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):

HOST=127.0.0.1 PORT=8000 OPEN_TERMINAL_CORS_ALLOWED_ORIGINS='https://your-openwebui.example' ./scripts/install-open-terminal-systemd-user.sh
HOST=127.0.0.1 PORT=8000 OPEN_TERMINAL_CORS_ALLOWED_ORIGINS='https://your-openwebui.example' ./scripts/macos/install-open-terminal-launchagent.sh

macOS only — custom initial folder for Open Terminal (must exist before you save it):

OPEN_TERMINAL_WORKING_DIRECTORY="$HOME/projects/my-repo" ./scripts/macos/install-open-terminal-launchagent.sh

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.


License

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:

  • Your use is non-commercial (personal, educational, no revenue), or
  • Your organization has no more than 10 individuals using it

Commercial use beyond these limits (e.g., teams of 11+ or commercial deployment) requires a paid license.

  • Effective 2030-02-25, this version converts to Apache License 2.0 (fully open source)
  • Commercial licenses: [email protected]

See LICENSE for full terms.

Reviews (0)

No results found