IntentRoute-AI README

The project's README from github.com/Vincent-Xi08/IntentRoute-AI. As one markdown file: README.md.

IntentRoute AI

English | 中文

CI Release License: MIT

IntentRoute AI is an open-source Windows control plane that turns plain-language network intent into locally validated routing-rule drafts. It can use the OpenAI Responses API or an already-running local Ollama model, then hands accepted rules to the same deterministic sing-box TUN configuration pipeline used by the manual editor.

Project status: v0.24.0 preview. IntentRoute AI is useful for testing and early adoption, but it has not yet demonstrated broad production usage. AI output can be incomplete or wrong. Every generated rule is locally validated, added disabled, and must be explicitly enabled by the user.

v0.19.0 adds batch mode buttons (proxy/direct/block) to the rules toolbar — exposing the previously UI-less SetRulesMode transaction — and severity coloring for runtime logs. v0.18.0 completed the UI renewal with theme-colored page banners and unified list-page grammar; v0.16–v0.17 established the shared dark design system and component-library polish; v0.15.0 added the rule-import preview with full-identity duplicate detection. Every release archive still embeds the unsigned provenance.json build inventory introduced in v0.9.0; code signing itself still requires a certificate.

Why this project exists

Many Windows applications do not expose useful proxy controls, while hand-authoring process/domain/IP routing rules is error-prone. IntentRoute AI provides two complementary paths:

The application does not capture packets itself. It generates a validated sing-box v1.13+ TUN configuration, starts and supervises the external sing-box process, and keeps the default route direct unless a rule says otherwise.

AI workflow

  1. Select OpenAI or Ollama (local).
  2. Enter an intent such as: “Route Chrome and Cursor traffic for GitHub and OpenAI through the proxy; keep everything else direct.”
  3. The provider returns a strict structured draft containing process, host/IP, port, protocol, action, rationale, confidence, and warnings.
  4. IntentRoute AI treats the result as untrusted input and validates field limits, executable names, domains, CIDRs, ports, protocols, actions, duplicates, and proxy availability.
  5. A temporary enabled candidate is passed through SingBoxConfigBuilder so disabled-rule filtering cannot make validation a no-op. This preview dry-run is deterministic in-process config construction; it intentionally does not execute an external program.
  6. The user reviews the preview and may edit any draft field (process, action, domains, IP/CIDR, ports, protocol, rationale). Every edit re-runs the same deterministic validation — including the enabled-clone dry-run — before the draft can be accepted as disabled rules.
  7. Enabling remains a separate user action. That state-changing path writes a candidate file and executes sing-box check -c before the managed runtime is replaced.

AI never directly enables rules, invokes commands, selects files, installs models, downloads sing-box, or applies an unreviewed configuration.

AI Policy Intelligence workflow

  1. Open AI Policy Intelligence. A cancellation-aware background worker analyzes a detached configuration snapshot without blocking the WPF dispatcher; this performs no provider request, filesystem write, runtime apply, executable probe, proxy connection, DNS lookup, or traffic observation.
  2. Findings use the same Canonical Runtime Order as the generated sing-box route: priority ascending, creation timestamp ascending, then persisted source order. The rules page uses that order too.
  3. The local report distinguishes exact duplicates, same-scope different outcomes, proven earlier-superset shadowing, broad process/global rules, invalid disabled rules, inactive duplicates, same-priority overlaps, the ProxyAll default posture, and non-proven partial-overlap hints. Equivalent suffix, integer-port-union, and mergeable CIDR-union spellings are canonicalized before comparison. Uncertain partial overlaps are not promoted into facts.
  4. Local rows may show real rule labels and can navigate to an affected rule. They are never serialized to a provider.
  5. To request an explanation, select 1–20 findings and click Explain selected summary with AI. A confirmation dialog shows the exact logical JSON, provider, and exclusion list for that single request.
  6. The closed Policy Disclosure contains only aggregate counts plus finding code, category, severity, relationship, and affected-rule count. The AI response must use a strict schema and reference only those finding codes.
  7. AI explanation is plain, untrusted, read-only text. It cannot change local findings, write a note, create/enable/reorder a rule, save configuration, or apply sing-box. The local fingerprint is rechecked before preview, after confirmation but before sending, and after the response; stale summaries are not sent and stale responses are discarded.

Policy Intelligence describes static configuration semantics, not real connection behavior. A clean report is not proof that TUN creation, a proxy listener, authentication, upstream reachability, DNS behavior, or a particular connection succeeded.

AI Route Decision Simulator

  1. Open AI Route Simulator and enter one exact process name, one concrete domain or literal IPv4/IPv6 address, one port, and TCP or UDP.
  2. A bounded background worker validates the detached Configuration Snapshot through the production SingBoxConfigBuilder, then evaluates enabled rules in Canonical Runtime Order.
  3. The result is deliberately three-valued: a proven first-rule match, a proven global fallback after all rules miss, or Indeterminate when a missing resolved IP/domain context could allow an earlier rule to win. Invalid input and invalid policy are separate fail-closed states and never return an action.
  4. The page shows a local evaluation trace and can navigate to a proven matched rule. A fingerprint binds the result to both the snapshot and normalized query; query or configuration changes hide the old result.
  5. Recovery Protection disables simulation rather than evaluating the empty placeholder state.

This is a static what-if tool, not telemetry. It does not resolve DNS, reverse-resolve an IP, probe a proxy, inspect connections, read runtime logs, enumerate packets, invoke sing-box, or change/apply configuration. The hypothetical query, local rule labels/IDs, proxy identity, and evaluation trace never cross an AI-provider seam.

Provider setup

OpenAI

IntentRoute AI reads the user's key at request time from OPENAI_API_KEY. The key is not accepted in the app UI and is never written to the application configuration, profiles, logs, exports, or diagnostics.

PowerShell example for the current Windows user:

[Environment]::SetEnvironmentVariable('OPENAI_API_KEY', 'your-api-key', 'User')

Restart IntentRoute AI after changing the environment variable. The OpenAI request uses the Responses API, strict JSON Schema output, no tools, a bounded timeout/output size, and store=false.

Local Ollama

Install Ollama, start its local service, and install a model separately. For example:

ollama pull qwen3:8b

IntentRoute AI queries only literal HTTP 127.0.0.1 (the default) or ::1. It rejects hostnames, other loopback addresses, credentialed endpoints, HTTPS, LAN, and public Ollama endpoints; disables proxy use and redirects for these requests; and never pulls a model or launches Ollama automatically. The UI lists models already installed through GET /api/tags.

Health diagnostics

The Settings page offers a credential-free provider health check for the currently selected provider and model. For OpenAI it reports only whether OPENAI_API_KEY is present — the key is never displayed and no network request is sent. For Ollama it reports loopback service reachability, the installed-model count, and whether the selected model is installed. Diagnostics never contain credentials or endpoints beyond the literal loopback constant.

AI data boundary

Data OpenAI Local Ollama
User-entered intent Sent Sent to loopback only
Static rule schema/instructions Sent Sent to loopback only
User-selected Policy Disclosure after exact preview/confirmation Sent Sent to loopback only
Route Simulator hypothetical query or local evaluation trace Never Never
Proxy username/password Never Never
Proxy server address Never Never
Existing rule values, IDs, labels, notes, or complete configuration Never Never
Process names, domains, IPs, ports, or paths from existing rules Never Never
Runtime logs Never Never
Full process list or paths Never Never
API key Authorization header only Not applicable locally

OpenAI API data handling is governed by the user's OpenAI account and current API policies. store=false is an application-level request setting, not a promise that no provider-side security or abuse-monitoring processing exists. Ollama mode keeps the application request on loopback, but the privacy and behavior of the installed model/runtime remain the user's responsibility.

Current routing capabilities

IntentRoute AI does not provide a proxy node, VPN account, packet driver, bundled AI model, OpenAI API key, or sing-box binary.

Install a preview build

  1. Download IntentRoute-AI-v0.24.0-win-x64.zip and its .sha256 file from Releases.
  2. Verify the checksum.
  3. Download the official Windows x64 sing-box v1.13+ archive separately.
  4. Install sing-box.exe separately, then explicitly approve its exact file from Settings → Browse on every elevated app launch. The saved path, imported profiles/configurations, INTENTROUTE_SING_BOX, the legacy PROXYMANAGER_SING_BOX, the application directory, and PATH are candidate-discovery hints only: they may be displayed, but neither version, check, nor run executes until that file is reselected in the current session.
  5. Ensure an existing proxy service is listening on a literal loopback IP such as 127.0.0.1 or ::1. The Settings page can save SOCKS5/HTTP/HTTPS username and password values and can check whether the local TCP port accepts a connection.
  6. Run IntentRouteAI.exe as administrator. TUN creation requires elevation.

The self-contained release targets Windows x64 and does not require a separate .NET runtime.

Configuration and upgrade migration

Current data is stored under %APPDATA%\IntentRouteAI. On first launch, if the new directory has no current configuration, the application copies only config.json and *.profile.json from %APPDATA%\ProxyManager. Copying holds a per-directory exclusive migration lock and uses an in-progress marker plus atomic per-file moves, so an interrupted migration retries only missing known files on the next launch and never overwrites a completed copy. It deliberately does not copy generated sing-box configs, runtime leases, locks, or candidates, and it never deletes the legacy directory automatically.

Proxy passwords are protected at rest with DPAPI CurrentUser. Passwords entered in the UI are always treated as plaintext before storage, including legitimate values that begin with the reserved on-disk dpapi: marker. The generated %APPDATA%\IntentRouteAI\sing-box.generated.json necessarily contains any configured credential in plaintext while sing-box is running. The application removes it on stop, clean exit, and unexpected child exit; the next launch performs bounded orphan recovery and stale-artifact cleanup. Cleanup remains best effort under disk, ACL, administrator, or abrupt-crash interference.

Since v0.3.0, malformed JSON, invalid UTF-8, a null document or collection entry, a rule without a non-empty process name, duplicate rule/server IDs, an explicitly null/empty ID or an omitted Id JSON property, any non-empty proxy-chain definition, or a dpapi: password that cannot be decrypted for the current Windows user makes the configuration unusable, not empty. Persisted object IDs are required JSON members; model initializers may create IDs for new in-memory objects but cannot repair imported data silently. Proxy chains remain parseable only so legacy or imported data can be rejected explicitly; IntentRoute AI does not persist or silently ignore them until an actual sing-box runtime mapping exists. A global rule must use the explicit * process name; a missing name is never interpreted as global routing. IntentRoute AI leaves the original file untouched, attempts to create a timestamped config.json.corrupt-*.bak copy, blocks all save and runtime-apply paths, and shows explicit import/reset recovery controls. Import validates the supported endpoint and routing semantics before replacement. Both import replacement and reset are disabled unless the recovery copy still exists. If the copy could not be created, the user must first make a manual copy and restart the application so preservation can be verified before replacement.

Normal edits, rule imports, AI-draft acceptance, Profile replacement, recovery, and reset use one Configuration Workspace transaction. The application clones the active configuration, applies and validates the complete candidate, atomically saves it, and only then publishes a new detached snapshot. A validation or save failure leaves memory and disk unchanged. Local edits preserve a current-session sing-box approval only while the executable path is unchanged; Profile replacement, recovery, and reset always clear it. Clearing approval cancels any queued replacement apply. If cancellation arrives after a candidate process has started, IntentRoute AI restores the prior generated configuration and restarts its prior process before publishing RunningStale; cancellation and green-state publication are serialized so a late Apply cannot overwrite the warning. The executable must be explicitly approved again before the current configuration can be applied.

Candidate path/version probe results remain local to the attempted Apply. Runtime status changes its executable path and version only when that executable is actually started, and clears them when no managed process remains. A rejected candidate therefore leaves the old PID/path/version aligned; failed-start and cancellation rollback restart the prior configuration with the prior executable rather than the rejected candidate.

Cancellation before candidate promotion (including version probe, candidate write, and external check) also converges to a terminal runtime status: RunningStale when the prior process remains active, or Failed when no managed process exists. Direct runtime callers therefore cannot leave status indefinitely in Starting, Probing, or Checking after cancellation.

The local proxy Test port action only performs a TCP connection to the entered literal loopback IP with a five-second bound. It sends no username or password and does not prove SOCKS/HTTP negotiation, authentication, upstream reachability, DNS behavior, or routed application traffic.

Build and test

Requirements for source builds:

./scripts/test.ps1
./scripts/check-vulnerabilities.ps1
./scripts/build.ps1
./scripts/smoke-test-wpf.ps1 -OutputDirectory ./artifacts/win-x64
./scripts/test-pinned-sing-box.ps1

Provider tests use mocked HTTP handlers. They do not require an OpenAI key, a paid API call, a running Ollama service, or a downloaded local model. The Windows CI also launches the published single-file executable, verifies that the expected WPF main window is created, requests a normal close, and requires a clean zero exit.

The explicit test-pinned-sing-box.ps1 developer/CI gate temporarily downloads the official sing-box v1.13.19 Windows archive, verifies its pinned SHA-256, passes representative SingBoxConfigBuilder output through the real sing-box check, and removes the temporary executable and generated configurations. This test-only dependency is never copied into application artifacts; IntentRoute AI itself still never downloads or bundles sing-box. Pass -SingBoxPath C:\path\to\sing-box.exe to test an already-installed exact v1.13.19 executable without downloading it.

Architecture and security

IntentRoute-AI (Vincent-Xi08/IntentRoute-AI)

Searching Database…

这是什么?IntentRoute AI 是一款开源 Windows 应用,把自然语言描述的网络分流意图转化为经过本地验证的 sing-box TUN 规则,使用 OpenAI Responses API 或本地 Ollama 模型作为草稿助手。
它本身是代理,还是只是规则管理器?它是一个 WPF 桌面控制平面,不是抓包代理。它构建经过验证的 sing-box TUN 配置,然后启动并监督外部 sing-box 进程来实际传输流量。
怎么使用 AI 分流功能?选择 OpenAI 或本地 Ollama,输入一条意图,比如“让 Chrome 和 Cursor 访问 GitHub 的流量走代理”,检查提供商返回的结构化草稿(进程、主机、端口、动作、理由),需要时修改任意字段,然后由你自己显式启用规则。
需要 OpenAI 密钥还是本地安装 Ollama?用 OpenAI 的话,设置 OPENAIAPIKEY 环境变量(密钥从不在界面中输入,也不会存储)。本地使用的话,自行安装 Ollama、启动其服务并安装模型——IntentRoute AI 只与 127.0.0.1 或 ::1 通信,绝不访问远程 Ollama 端点。
AI 能直接修改我的网络规则吗?不能。每条 AI 生成的规则都以禁用状态添加,必须由用户在审查后手动启用;AI 绝不会执行命令、选择文件、安装模型、下载 sing-box,也不会自行应用未经审查的配置。该项目目前也仍处于 v0.24.0 预览阶段,尚未经过广泛的生产使用验证。
发送给 OpenAI 和 Ollama 时分别有哪些数据会离开我的电脑?只发送你输入的意图、静态规则模式,以及经用户确认的聚合式 Policy Disclosure 摘要(Ollama 的话只发到回环地址)。现有规则的值、ID、标签、备注、完整配置、代理凭据、运行时日志和 Route Simulator 查询绝不会发送给任何提供商。
AI Policy Intelligence 功能是什么?这是一个本地后台分析器,扫描你保存的 sing-box 规则,找出重复、冲突、遮蔽和范围过宽的问题;之后你可以选中具体发现,只把聚合计数发送给 AI,换取通俗语言的解释。
Route Decision Simulator 是做什么的?你输入一个假想的进程、域名或 IP、端口和协议,它会评估你保存的规则,返回确定匹配、确定回退或“不确定”的结果——这是静态的假设检查,不是实时流量监控。
为什么要做这个,而不是手动编辑 sing-box 配置?手工编写进程、域名和 IP 分流规则容易出错,所以 IntentRoute AI 把常规的手动规则编辑器与可选的 AI 助手结合起来,后者把自然语言意图转化为可审查、默认禁用的草稿。
Size
0.6 MB
Stars
279
Updated
CommitSep 14
Age
1mo
Commits · 90 Days