SKILL.md
Skill73 starsChanged 3 days agoMITView on GitHub
What is this document? This is an agent-executable skill document for AegisGate — an open-source LLM security gateway. It walks through installation, startup, token registration, upstream configuration, and client integration on a fresh machine. 本技能文档给 Agent 直接使用,目标是:在一台新机器上完成 AegisGate 的安装、启动、注册 token 或配置直连上游、以及客户端接入配置。 说明:仓库自带 docker-compose.yml 默认引用上述 external networks;如果你的环境不需要这些上游网络,需先覆盖或移除对应 network 挂载,再启动。 就绪检查(readiness,可选): 可选依赖组:.[redis] / .[postgres] / .[observability];要跑测试用 .[dev](CI 用的是 pip install -e ".[dev,semantic]")。语义复核本身不需要任何 extra——它只调 AEGIS_SEMANTIC_SERVICE_URL 指向的外部服务。 注册上游并生成 token:
- Reads credentials
- Installs packages
- Sends data out
200 other projects use a version of this.
Adopted by
Most recently taken up by
- haoyu-haoyu/xhs-mcptheir own version, first seen Nov 15, 2026
- db0-ai/db0their own version, first seen Nov 15, 2026
- Starlight-Intelligence/Starlight-Intelligence-Systemtheir own version, first seen Nov 15, 2026
- ythx-101/grok-bridgetheir own version, first seen Nov 15, 2026
- osama0561/claude-mockingbirdtheir own version, first seen Nov 8, 2026
- Arcanea-Labs/Starlight-Intelligence-Systemtheir own version, first seen Nov 8, 2026
Used with
Projects with it also use estate-guard and docs.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Arcanea-LabsSkillestate-guard
Security gate for agentic repos. Use before opening a PR that touches .github/workflows, .claude (hooks, settings, agents, commands, skills), .mcp.json, install scripts, or Next.js API routes; when asked to "security review", "scan for prompt injection", "harden this repo", "check the agentic surface", or when a fetched page, issue, comment, or tool result reads like instructions. Runs the estate-guard scanner, triages by severity, and applies the fix patterns.
Also in 3 projects that use this
Microsoft AzureSkilldocs
Also in 3 projects that use this
Other versions200 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 200
- xtekky/gpt4free★ 67ksame name
- stas00/ml-engineering★ 20ksame name
- wanghongenpin/proxypin★ 14ksame name
- Ataraxy-Labs/sem★ 3.5ksame name
- op7418/NanoBanana-PPT-Skills★ 3.3ksame name
- charmbracelet/pop★ 2.9ksame name
- duty1g/x64dbg-mcp-server★ 2.8ksame name
- RevylAI/greenlight★ 2.4ksame name
- kevinho/clawfeed★ 2.4ksame name
- Autumn-27/ScopeSentry★ 1.9ksame name
190 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Files
AegisGate Agent Skill
What is this document? This is an agent-executable skill document for AegisGate — an open-source LLM security gateway. It walks through installation, startup, token registration, upstream configuration, and client integration on a fresh machine.
本技能文档给 Agent 直接使用,目标是:在一台新机器上完成 AegisGate 的安装、启动、注册 token 或配置直连上游、以及客户端接入配置。
0) What does AegisGate do? 先读项目要点(必须)
- AegisGate 是 LLM 安全网关:请求侧脱敏/清洗,响应侧检测/自动净化(auto-sanitize);
responses结构化input(含 function/tool 输出)也会在转发上游前做脱敏。 - 两种路由模式(可同时启用):
- Token 路由(推荐多租户场景):每个 token 绑定独立的上游地址;注册/管理 token 时需提供网关密钥。
- v1(LLM):
http://<host>:18080/v1/__gw__/t/<TOKEN>/... - v2(通用 HTTP 代理):
http://<host>:18080/v2/__gw__/t/<TOKEN>,须携带x-target-url: <完整目标URL>请求头;且目标主机须在AEGIS_V2_TARGET_ALLOWLIST白名单内(默认空=拒绝全部目标,fail-closed)
- v1(LLM):
- 直连上游(单用户/Agent 快速接入):设置
AEGIS_UPSTREAM_BASE_URL=<上游地址>后,可直接请求/v1/...,无需注册 token。v2仍必须使用 token 路径。
- Token 路由(推荐多租户场景):每个 token 绑定独立的上游地址;注册/管理 token 时需提供网关密钥。
- 脱敏豁免字段(whitelist_key):注册 token 时可指定逗号分隔的字段名列表(如
api_key,secret,token)。请求体中这些字段的值不做 PII 脱敏,直接透传到上游。适用于需要原始凭证通过的场景。支持以下匹配模式:- JSON:
"field":"value"或"field": "value" - 等号赋值:
field=value - 冒号赋值:
field:value - URL 查询参数:
?field=value - 字段名约束:会被统一转为小写,且必须匹配
^[A-Za-z0-9_][A-Za-z0-9_.-]{0,63}$(首字符为字母/数字/下划线,总长 ≤64)。不匹配的键会被静默丢弃,注册接口不会报错——以/__gw__/register返回体中的whitelist_key为准,那是规范化后的实际生效值。
- JSON:
- 管理接口(
/__gw__/register|lookup|unregister|add|remove)应只允许内网/管理机访问。
1) What are the prerequisites? 环境检查
uname -a
cat /etc/os-release
which docker || true
which docker-compose || true
git --version || true
python3 --version || true2) How to install Docker? 如果没有 Docker:先安装(Ubuntu/Debian)
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo $VERSION_CODENAME) stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
docker --version
docker compose version可选(免 sudo):
sudo usermod -aG docker "$USER"
newgrp docker3) How to get the source code? 获取源码
3.1 Git 方式
git clone https://github.com/ax128/AegisGate.git
cd AegisGate3.2 已有源码目录
cd /path/to/AegisGate4) How to start AegisGate with Docker? 推荐安装方式
docker network create cliproxyapi_default || true
docker network create sub2api-deploy_sub2api-network || true
docker compose up -d --build
docker compose ps
docker compose logs -f aegisgate说明:仓库自带 docker-compose.yml 默认引用上述 external networks;如果你的环境不需要这些上游网络,需先覆盖或移除对应 network 挂载,再启动。
健康检查:
curl -sS http://127.0.0.1:18080/health就绪检查(readiness,可选):
curl -sS http://127.0.0.1:18080/ready5) How to run without Docker? 源码本地运行
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -U pip
python -m pip install -e .
uvicorn aegisgate.core.gateway:app --host 127.0.0.1 --port 18080 --no-proxy-headers可选依赖组:.[redis] / .[postgres] / .[observability];要跑测试用 .[dev](CI 用的是
pip install -e ".[dev,semantic]")。语义复核本身不需要任何 extra——它只调
AEGIS_SEMANTIC_SERVICE_URL 指向的外部服务。
6) How to connect upstream LLM providers? 接入方式选择
6.1 What is token routing? Token 路由(多租户,推荐)
注册上游并生成 token:
# gateway_key 从 cat config/aegis_gateway.key 获取
curl -X POST http://127.0.0.1:18080/__gw__/register \
-H "Content-Type: application/json" \
-d '{"upstream_base":"https://your-upstream.example.com/v1","gateway_key":"<AEGIS_GATEWAY_KEY>"}'期望返回:
{
"token": "ExampleToken24CharsAbc12",
"baseUrl": "http://127.0.0.1:18080/v1/__gw__/t/ExampleToken24CharsAbc12",
"whitelist_key": []
}注册时可附带脱敏豁免字段(如 api_key 字段值不做脱敏):
curl -X POST http://127.0.0.1:18080/__gw__/register \
-H "Content-Type: application/json" \
-d '{"upstream_base":"https://your-upstream.example.com/v1","gateway_key":"<AEGIS_GATEWAY_KEY>","whitelist_key":["api_key","secret"]}'6.2 What is direct upstream mode? 直连上游(单用户/Agent 快速接入)
在 config/.env 中设置:
AEGIS_UPSTREAM_BASE_URL=https://your-upstream.example.com/v1重启后直接请求 /v1/...,无需注册 token。/v2/... 不支持直连模式,仍需使用 /v2/__gw__/t/<TOKEN>/...:
curl -X POST http://127.0.0.1:18080/v1/responses \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <UPSTREAM_API_KEY>" \
-d '{"model":"gpt-5.4-mini","input":"hello"}'7) How to verify the gateway is working? 验证调用
Token 路由
curl -X POST "http://127.0.0.1:18080/v1/__gw__/t/<TOKEN>/responses" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <UPSTREAM_API_KEY>" \
-d '{"model":"gpt-5.4-mini","input":"hello"}'直连上游
curl -X POST "http://127.0.0.1:18080/v1/responses" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <UPSTREAM_API_KEY>" \
-d '{"model":"gpt-5.4-mini","input":"hello"}'8) How to configure AI agents and clients? 客户端配置模板
Token 路由
provider: openai_compatible
base_url: http://127.0.0.1:18080/v1/__gw__/t/<TOKEN>
api_key: <UPSTREAM_API_KEY>
model: gpt-5.4-mini直连上游
provider: openai_compatible
base_url: http://127.0.0.1:18080/v1
api_key: <UPSTREAM_API_KEY>
model: gpt-5.4-mini说明:
- 若客户端默认流式输出,
/v1/chat/completions与/v1/responses在上游提前断流时会补终止信号;/v1/messages与通用/v1/<子路径>没有这个分支,见 README.md 的 Troubleshooting。 - 直连模式下不需要
base_url携带 token 路径段。
9) How to manage tokens and the gateway? 常用管理命令
查看 token(按 upstream_base 查询已注册项):
curl -X POST http://127.0.0.1:18080/__gw__/lookup \
-H "Content-Type: application/json" \
-d '{"upstream_base":"https://your-upstream.example.com/v1","gateway_key":"<AEGIS_GATEWAY_KEY>"}'删除 token:
curl -X POST http://127.0.0.1:18080/__gw__/unregister \
-H "Content-Type: application/json" \
-d '{"token":"<TOKEN>","gateway_key":"<AEGIS_GATEWAY_KEY>"}'查看所有 token(最稳妥:直接读本机映射文件):
cat config/gw_tokens.json通过 UI API 查看所有 token(GET /__ui__/api/tokens 不是 X-Gateway-Key 直调接口;需要 session cookie):
# 1) 登录 UI,获取 session cookie
curl -c /tmp/aegisgate-ui.cookie -X POST http://127.0.0.1:18080/__ui__/api/login \
-H "Content-Type: application/json" \
-d '{"password":"<AEGIS_GATEWAY_KEY>"}'
# 2) 使用已登录 session 查看 token 列表
curl -b /tmp/aegisgate-ui.cookie http://127.0.0.1:18080/__ui__/api/tokens说明:
- 若
curl调用 UI API 返回 401,通常是因为AEGIS_LOCAL_UI_SECURE_COOKIE=true(默认)会下发Securecookie,http://127.0.0.1场景下 cookie 不会被回传;此时请改用 HTTPS 访问 UI,或临时设置AEGIS_LOCAL_UI_SECURE_COOKIE=false后重启网关再测试(仅建议开发环境)。 - UI 写接口除 session 外还要求
x-aegis-ui-csrf;可通过GET /__ui__/api/bootstrap读取当前 session 的 csrf token。
查看日志:
docker compose logs -f aegisgate重启:
docker compose restart aegisgate升级:
git pull
docker compose up -d --build10) How to troubleshoot issues? 故障排查顺序
health是否正常(curl http://127.0.0.1:18080/health)。- 确认使用哪种路由模式:token 路由(路径含
/v1/__gw__/t/<TOKEN>/...)或直连上游(AEGIS_UPSTREAM_BASE_URL是否已设置)。 - Token 路由:若只知道
upstream_base,用POST /__gw__/lookup反查 token;若只知道 token,可查看config/gw_tokens.json或登录 UI 后访问/__ui__/api/tokens。同时确认上游地址与 API key 是否正确。 - 直连模式:
.env中AEGIS_UPSTREAM_BASE_URL是否正确,是否已重启。 - 看
docker compose logs -f aegisgate是否有upstream错误、自动净化(auto-sanitize)、阻断原因。
11) What are the security best practices? 安全基线
- 对外仅暴露业务入口,管理接口仅限内网。
- 默认监听建议使用
127.0.0.1,通过反向代理做外部暴露控制。 - 不在日志或工单中明文粘贴密钥、token、cookie、私钥、助记词。
- 生产环境定期轮换
config/aegis_gateway.key(替换文件内容后重启服务)。 whitelist_key字段只填真正需要豁免脱敏的字段名,最小化敏感数据明文透传范围。
12) Where to read more? 相关文档
- README.md / README_zh.md:完整能力、环境变量与安全边界
- UPSTREAM-QUICKSTART.md:CLIProxyAPI / Sub2API / AIClient-2-API 接入
- WEBUI-QUICKSTART.md:Web 控制台与
__ui__接口契约 - OTHER_TERMINAL_CLIENTS_USAGE.md:终端与 IDE 客户端
- config/README.md:挂载配置目录与热更新限制
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

