yanacuti1121/Yana-AI

GitHub: yanacuti1121/Yana-AI

Yana AI 是专为 AI 编码 agent 设计的安全编排操作系统,通过九层运行时安全门在危险操作执行前进行拦截和审计。

Stars: 1 | Forks: 0

Yana AI

Yana AI

人类与 AI 之间的编排层 —— 为每个领域提供路由、安全和上下文。

由 Vũ Văn Tâm 构建 · 17 岁 · 越南 · 1,034,519 行代码

English · 🇻🇳 Tiếng Việt

CI

**Yana AI** 是一个专为 AI 编码工具设计的个人智能体操作系统 —— 包含 runtime 安全 hook、分层 memory、97 个专家 agent、3,518 项技能,以及一个能在危险的 AI 操作执行前进行拦截的 Rust runtime。 兼容 **Claude Code**、**Cursor**、**Windsurf**、**Antigravity**、**Kiro**、**OpenCode**、**Zed**、**Gemini**、**GitHub Copilot**、**Aider** 等。 **→ [完整文档与演示](https://yanacuti1121.github.io/yana-ai/)** · **[GitHub Marketplace](https://github.com/marketplace/yana-ai)** → [VISION.md](VISION.md) · [ARCHITECTURE.md](ARCHITECTURE.md) · [ROADMAP.md](ROADMAP.md) ## Yana AI 概览 ``` ┌──────────────────────────────────────────────────────────────────┐ │ Yana AI v0.41.0 │ │ "The orchestration layer between humans and AI — │ │ routing, safety, and context for every domain." │ │ │ │ Built by Vũ Văn Tâm · 17 · Vietnam · 1M+ lines │ └──────────────────────────────────────────────────────────────────┘ ``` ``` graph TB %% ── Mission ────────────────────────────────────────────────────────── subgraph MISSION["🎯 Mission — AI coding agent safety layer"] direction LR AGENT["Agent wants\nto run a command"] GATE["9-layer gate\nintercepts every call"] OUT["Execute ✅\nor BLOCK + log 🚫"] AGENT --> GATE --> OUT end %% ── Gate layers ────────────────────────────────────────────────────── subgraph GATES["🔒 9-Layer Gate System (L1 → L9)"] direction LR G1["L1\nAnti-evasion\nbase64, pipe-to-shell"] G2["L2\nShell sanitize\nquoting, metacharacters"] G3["L3\nEgress / SSRF\nprivate IPs blocked"] G4["L4\nSupply chain\ntyposquatting, CVEs"] G5["L5\nBlast radius\ndestructive scope cap"] G6["L6\nPermission tier\nagent authority check"] G7["L7\nCode signing\nECDSA-P256"] G8["L8\nMerkle audit\nhash-chain, tamper-proof"] G9["L9\nSovereign overlord\nhuman veto / freeze swarm"] G1 --> G2 --> G3 --> G4 --> G5 --> G6 --> G7 --> G8 --> G9 end %% ── Core engine ────────────────────────────────────────────────────── subgraph CORE["⚙️ Core Engine"] direction TB SKILLS["📚 3,518 skills\nSKILL.md workflow defs\n(frontend, backend, AI, K8s, sec...)"] AGENTS["🤖 97 specialist agents\n(planner, security-auditor,\nhoc-tap, daily-assistant...)"] RULES["📜 64 enforced rules\n(security, git, UI, TypeScript,\nAPI security, core-lock...)"] HOOKS["🪝 46 hooks\nPreToolUse · PostToolUse · Stop\n(guard-destructive, truth-gate...)"] CMDS["⚡ 164 slash commands\n/audit · /scan · /route\n/tdd-cycle · /simplify..."] BUS["🚌 Agent message bus\nJSON + ECDSA sig\nreplay-protected, BFT consensus"] MEM["🧠 Memory tiers\nL1 permanent · L2 session\nMerkle-chained, AES-256-GCM"] end %% ── Rust runtime ───────────────────────────────────────────────────── subgraph RT["⚡ Rust Runtime — yana-rt"] direction LR SCAN["scan · hunt · fix\nVulnerabilities, OWASP,\nsupply chain — 1256× faster"] ROUTE["route · mission\nTask classifier → simple/\ncomplex/external dispatch"] VAULT["graph · vault · doctor\nKnowledge graph,\nskill search, health check"] end %% ── Tools ──────────────────────────────────────────────────────────── subgraph TOOLS["🛠️ Tools — sub-projects"] direction LR YANA["yana-ai ✅\nZero-dep Node.js web UI\nAnthropic · Groq · Gemini · OpenAI\nSkill routing · SSE streaming"] CODEXMATE["codexmate\nOpenAI Codex integration\nVietnamese patch"] MOSS["moss-tts-nano\nTTS engine"] FINETUNE["finetune-vi\nVietnamese LLM fine-tuning"] end %% ── Harness adapters ───────────────────────────────────────────────── subgraph HARNESS["🔌 Harness Adapters (15)"] direction LR H1["Claude Code\nCursor · Zed"] H2["Gemini · Copilot\nAider · OpenCode"] H3["Cloudflare Workers\nGitHub Actions"] end %% ── Active branches ────────────────────────────────────────────────── subgraph BRANCHES["🌿 Active Branches"] direction LR BMAIN["main ✅\nv0.41.0 — stable"] BVDEV["v1.8.0-dev\nnext release (in progress)"] BCF["cloudflare/workers-autoconfig\nWorkers zero-config setup"] BCX["codex/fix-hello-bug-in-bn\nCodex compatibility"] end %% ── Product funnel ─────────────────────────────────────────────────── subgraph FUNNEL["📣 Product Funnel — 'Scan first. Guard later.'"] direction LR F1["① yana-ai audit .\n30s · no learning needed\nScan any repo for AI agent risks"] F2["② Policy Kit\nAdopt safe configs piece by piece\n(CLAUDE.md · .mcp.json · CI gates)"] F3["③ Full Control Layer\nAll 9 gates · 97 agents\nMerkle log · Sovereign veto"] F1 --> F2 --> F3 end %% ── Connections ────────────────────────────────────────────────────── MISSION --> GATES GATES --> CORE CORE --> RT CORE --> TOOLS CORE --> HARNESS ``` ## 问题所在 AI 编码 agent 会犯错。它们会 `rm -rf` 删错目录,会强制推送到 main 分支,会臆造测试结果,还会提交敏感信息。等你察觉时,损害已经造成。 Yana AI 处于 agent 和你的系统之间 —— 每次工具调用在执行前都会通过一个 9 层安全门。 ## 工作原理 ``` Agent wants to run a command ↓ [L1] Anti-evasion scan — blocks base64 decode+exec, pipe-to-shell [L2] Shell sanitization — quotes all variables, strips metacharacters [L3] Egress check — blocks SSRF, private IP ranges, metadata endpoints [L4] Supply chain gate — vets every package install (typosquatting, CVEs) [L5] Blast radius check — caps destructive scope [L6] Permission tier check — verifies agent authority level [L7] Signature verification — ECDSA-P256 on generated code [L8] Merkle audit log — append-only, tamper-detected hash chain [L9] Sovereign overlord gate — human veto, freeze swarm, full rollback ↓ Execute (or block + log) ``` ## 数据概览 | | | |---|---| | 🧩 技能 (Skills) | **3,518** 个工作流技能定义 | | 🤖 智能体 (Agents) | **97** 个专家 agent | | 📜 安全规则 | **63** 条强制执行规则 | | 🪝 Hook | **46** 个执行前/后 hook | | ⚡ 斜杠命令 | **164** 个 | | 🔌 Harness 适配器 | **15** 个 (Claude Code, Cursor, Windsurf, Antigravity, Kiro, OpenCode, Zed, Gemini, Copilot, Aider...) | | 🦀 Rust 子命令 | **19** 个 (`scan`, `graph`, `vault`, `route`, `mission`, `hunt`, `fix`, `doctor`...) | | ✅ CI 中的规则检查 | **826** 项 | | 📦 代码库总计 | **1,034,519 行 · 5,762 个文件** | ## 快速安装 **→ [从 GitHub Marketplace 安装](https://github.com/marketplace/yana-ai)** —— 一键点击,官方页面。 ``` # Claude Code plugin — npx yana-ai-install 接入 hooks # (要求:npm v12+ 默认不再运行 postinstall 脚本) npm install yana-ai && npx yana-ai-install # Python CLI pip install yana-ai # Rust 运行时(快 1256 倍的扫描器) cargo install yana-rt ``` ``` # 验证一切均已正确接入 yana-ai doctor . ``` ## 多 Harness 支持 Yana AI 能适配你使用的任何工具: ``` bash core/scripts/switch-engine.sh cursor # .cursorrules + 7 .cursor/rules/*.mdc bash core/scripts/switch-engine.sh opencode # OPENCODE.md bash core/scripts/switch-engine.sh zed # .zed/settings.json bash core/scripts/switch-engine.sh gemini # GEMINI.md bash core/scripts/switch-engine.sh copilot # .github/copilot-instructions.md bash core/scripts/switch-engine.sh status # check all 12 adapters ``` ## GitHub Action 在每个 PR 上扫描代码库的 AI agent 配置 —— 检查敏感信息、权限、hook 注入和 MCP 漏洞。 ``` # .github/workflows/yana-ai-scan.yml - uses: yanacuti1121/yana-ai/.github/actions/scan@main with: fail-on: 'high' # fail CI on HIGH or CRITICAL findings diff-only: 'true' # scan only changed files on PRs comment-on-pr: 'true' # post findings summary as PR comment ``` 在每个 PR 上发表评论: ``` 🟠 Yana AI Security Scan — HIGH | Metric | Value | |---------|--------| | Risk | HIGH | | Score | 58/100 | | Findings| 3 | ``` → [完整工作流模板](docs/install/github-action.yml) ## Rust 运行时 —— `yana-rt` 19 个子命令。零 Python 依赖。 ``` yana-ai scan . # security scan — secrets, CVEs, supply chain risks yana-ai graph . # knowledge graph — file deps, import resolution yana-ai vault search Q # search 3,518 skills by keyword yana-ai hunt . # hunt for security patterns (OWASP, injection, SSRF) yana-ai fix . # auto-fix rule violations yana-ai doctor . # full system health check yana-ai map . # blast radius map — what can the agent touch? yana-ai ci # run all gate checks (used in CI) yana-ai route classify "fix auth bug" # classify task → simple/complex/external yana-ai mission create "add-auth" # create parallel agent mission ``` **基准测试:** 在包含 1 万个文件的代码库上运行 `yana-ai scan`:比同等的 Python 脚本**快 1256 倍**。 ## 安全架构 ``` core/ ├── hooks/ # 46 PreToolUse / PostToolUse / Stop hooks ├── rules/ # 64 enforced rules (security, correctness, UI, git) ├── scripts/ # safe-run.sh, verify-core-lock.sh, secure-logger.sh ├── gates/ # truth_gate.md, action_gate.md ├── agents/ # 95 specialist agent definitions ├── skills/ # 3,518 SKILL.md files ├── config/ │ ├── core-lock.json # SHA-256 manifest — 216 core files pinned │ └── skills-lock.json # skill content hashes └── memory/ ├── L1_atomic/ # permanent facts — persist across sessions └── L2_session/ # session state — auto-expires ``` 核心特性: - **Merkle 审计链** —— 记录每一个操作,实现篡改检测 - **Core-lock 完整性** —— SHA-256 清单可检测 core/ 目录下的偏移、删除和规则注入 - **BFT 共识** —— 核心基础设施写入需要 3-of-N 投票 - **Sovereign overlord** —— 人类可以立即冻结全部 97 个 agent - **Honeypot 层** —— 诱饵文件/环境变量用于抓捕被攻陷的 agent ## 实际应用展示 ``` # Agent 尝试:git push --force origin main [yana-ai/02-terminal-validator] BLOCKED — force push prohibited Command : git push --force origin main Gate : L1 Fix : Run gate checks first, then push without --force # Agent 尝试:curl http://169.254.169.254/latest/meta-data/ [yana-ai/network-egress] BLOCKED — SSRF target detected Host : 169.254.169.254 Gate : L3 Exit : 3 # Agent 尝试安装未审核的 package [yana-ai/dependency-vetting] BLOCKED — unvetted package install Package : req-uests@2.28.0 Reason : typosquatting (similar to 'requests') Gate : L4 ``` ## Yana AI **[在线体验 →](https://yanai-production.up.railway.app)** Yana 是构建在 Yana AI 核心之上的第一个界面 —— 这是一个 Web UI,让任何人都可以与 AI 聊天、切换提供商并使用技能路由,而无需了解底层的基础设施。 ``` User → Yana AI → Yana AI Core (Router · Safety · Context) → Model ``` - 无需注册 —— 自带 API key - 🔐 **加密 key vault** —— 密钥采用 AES-256-GCM 存储,主密钥不可提取 (WebCrypto + IndexedDB),绝不以明文保存 - 多提供商:Anthropic · Groq · Gemini · OpenAI · DeepSeek · OpenRouter · 9Router · Ollama **提供商设置** —— 自带密钥,密钥在本地加密(绝不发送给 Yana AI): | 提供商 | 类型 | 设置 | |----------|------|-------| | **Claude** | Cloud | API key → [console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys) | | **OpenAI** | Cloud | API key → [platform.openai.com/api-keys](https://platform.openai.com/api-keys) | | **Gemini** | Cloud | API key → [aistudio.google.com/app/apikey](https://aistudio.google.com/app/apikey) | | **Groq** | Cloud | API key → [console.groq.com/keys](https://console.groq.com/keys) | | **DeepSeek** | Cloud | API key → [platform.deepseek.com/api_keys](https://platform.deepseek.com/api_keys) | | **OpenRouter** | Cloud | API key → [openrouter.ai/settings/keys](https://openrouter.ai/settings/keys) | | **9Router** | Local | `npm install -g 9router` → `9router` (运行在 `localhost:20128`) | | **Ollama** | Local | [ollama.com/download](https://ollama.com/download) → `ollama serve` → `ollama pull llama3.2` | - 📊 **100% 真实数据** —— 实时提供商统计、L1 memory 花园、审计日志健康面板;零演示数据 - 内置技能路由 —— 自然输入,Yana AI 自动分发至正确的 agent - **非编码用例:** 学习(苏格拉底式学习助手),日常工作(总结 / 计划 / 草拟) - SSE 流式传输,适配移动端 · Electron 桌面外壳 (`tools/yana-desktop`) 如果 Yana AI 是电网,那么 Yana 就是接入它的第一座建筑。 ## 将 Yana AI 添加到你的代码库 **静态徽章** —— 粘贴到你的 README 中: ``` [![Protected by Yana AI](https://img.shields.io/badge/protected%20by-Yana AI%20ENGINE-ff6b35?style=for-the-badge)](https://github.com/yanacuti1121/yana-ai) ``` **动态审计徽章** —— 显示实时安全评分: ``` yana-ai badge . # prints badge markdown with current score yana-ai badge . --json # machine-readable output ``` **GitHub Action** —— 自动扫描每个 PR: ``` - uses: yanacuti1121/yana-ai/.github/actions/scan@main with: fail-on: 'high' ``` → [完整工作流模板](docs/install/github-action.yml) ## Yana 任务路由器 每个任务在执行前都会被分类 —— 不再纠结是该直接处理还是分发给某个 agent。 ``` yana-ai route classify "implement JWT refresh token" # → { "route": "complex", "gate": "harness", "confidence": 0.36, # "suggested_agents": ["security-engineer", "backend-developer"] } yana-ai route classify "xem git log 10 commit" # → { "route": "simple", "gate": "auto", "confidence": 0.43 } yana-ai route classify "deploy to production" # → { "route": "external", "gate": "confirm", "confidence": 0.30 } ``` 五条路由: - **simple** → Yana 直接处理(只读,不需要 agent) - **skill** → 匹配 3,518 条目的索引,分发至精确的技能 agent - **learn** → 路由到 `hoc-tap` —— 苏格拉底式学习助手(在触发“learn”、“explain”、“why”时激活 —— 支持英语和越南语) - **daily** → 路由到 `daily-assistant` —— 总结 / 计划 / 草拟(在触发“summarize”、“write an email”、“make a plan”时激活 —— 支持英语和越南语) - **complex** → 携带范围界定简报分发给专家 agent - **external** → 停止,在继续之前向人类确认 领域感知的 agent 选择:auth 任务 → `security-engineer`,database 任务 → `database-expert`,UI 任务 → `frontend-developer + ui-ux-designer`。 ## Mission 调度器 基于波次的并行编排,内置依赖解析 —— 采用 Rust 编写,零 Python 依赖。 ``` # 1. 创建 mission MID=$(yana-ai mission create "implement-auth" | awk '/id:/{print $2}') # 2. 声明带有依赖的 tasks yana-ai mission task $MID "design-schema" --agent database-expert --produces schema.sql yana-ai mission task $MID "implement-auth" --agent backend-developer \ --consumes schema.sql --produces src/auth.ts yana-ai mission task $MID "write-tests" --agent test-engineer \ --consumes src/auth.ts --produces tests/auth.test.ts # 3. 调度 wave 1 —— 仅调度依赖已满足的 tasks yana-ai mission dispatch $MID --max-parallel 3 # → 为每个就绪的 agent 生成 JSON 简报 # 4. 标记完成,调度下一波 wave yana-ai mission done $MID "design-schema" --evidence schema.sql yana-ai mission dispatch $MID # → wave 2 unlocked # 取消 / 重试卡住的 tasks yana-ai mission cancel $MID "implement-auth" yana-ai mission retry $MID "write-tests" ``` 任务在调度时被标记为 **Running** —— 重新运行 `dispatch` 绝不会重复调度同一个任务。 ## 多智能体启动器 在硬性限制和强制终止开关下并行启动多个 agent: ``` # 启动 3 个 agents,最多 3 个并行运行 bash core/scripts/multi-agent-launch.sh start \ --agents "scanner,auditor,qa-team" \ --concurrency 3 # 实时状态 bash core/scripts/multi-agent-launch.sh status # 停止一个特定的 agent bash core/scripts/multi-agent-launch.sh kill scanner # Kill switch —— 立即停止一切 bash core/scripts/multi-agent-launch.sh kill all # 追踪一个 agent 的日志 bash core/scripts/multi-agent-launch.sh log auditor ``` 或者通过任务列表文件驱动: ``` # tasks.txt —— 每行一个 task:agent_name:task 描述 echo "scanner:scan the whole repo auditor:check the hooks qa-team:run the test suite" > tasks.txt bash core/scripts/multi-agent-launch.sh start --tasks-file tasks.txt --concurrency 4 ``` 输出示例: ``` ═══ Yana AI Multi-Agent Launcher ═══ Agents : 3 Concurrency: 3 (max running in parallel) Kill switch: bash multi-agent-launch.sh kill all [LAUNCH] scanner → scan the whole repo PID 12341 [LAUNCH] auditor → check the hooks PID 12342 [LAUNCH] qa-team → run the test suite PID 12343 [OK] Launched 3/3 agents ``` 代码库配置中定义了 97 个专家角色 通过代码库扫描发现了 3,518 个技能定义 包含 5,762 个文件,共 1,034,519 行代码,于 2026-06-10 统计 ## 联系方式 **Vũ Văn Tâm** · 越南 · 17 岁 | | | |---|---| | 邮箱 | phamlongh230@gmail.com | | 网站 | [yanacuti1121.github.io/yana-ai](https://yanacuti1121.github.io/yana-ai/) | | GitHub | [yanacuti1121/Yana-AI](https://github.com/yanacuti1121/Yana-AI) | | Yana AI | [yanai-production.up.railway.app](https://yanai-production.up.railway.app) | ## 🇻🇳 Tiếng Việt Bản dịch tiếng Việt đầy đủ của tài liệu này: **[README.vi.md](README.vi.md)**
标签:AI智能体, AI编排, AI自动化, Claude Code, DLL 劫持, MITM代理, 任务编排, 可视化界面, 大语言模型, 安全防护, 逆向工具