网淘吧来吧,欢迎您!

Project Orchestrator技能使用说明

2026-03-31 新闻来源:网淘吧 围观:17
电脑广告
手机广告

项目协调器

通过共享知识库协调多个AI编码代理

功能

  • 多项目支持:通过隔离数据管理多个代码库
  • Neo4j知识图谱:代码结构、关系、计划、决策
  • Meilisearch:跨代码和决策的快速语义搜索
  • Tree-sitter:支持12种语言的精确代码解析
  • 计划管理:具有依赖关系和约束的结构化任务
  • MCP集成:为Claude Code、OpenAI Agents和Cursor提供62种工具

文档

快速开始

1. 启动后端服务

cd {baseDir}
docker compose up -d neo4j meilisearch

2. 构建并运行编排器

cargo build --release
./target/release/orchestrator serve

或使用 Docker:

Project Orchestrator

docker compose up -d

3. 同步您的代码库

# Via CLI
./target/release/orch sync --path /path/to/project

# Via API
curl -X POST http://localhost:8080/api/sync \
  -H "Content-Type: application/json" \
  -d '{"path": "/path/to/project"}'

使用说明

创建项目

# Create a new project
curl -X POST http://localhost:8080/api/projects \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Embryon",
    "root_path": "/Users/triviere/projects/embryon",
    "description": "Neural network composition framework"
  }'

# List all projects
curl http://localhost:8080/api/projects

# Sync a project
curl -X POST http://localhost:8080/api/projects/embryon/sync

# Search code within a project
curl "http://localhost:8080/api/projects/embryon/code/search?q=tensor&limit=10"

创建计划

orch plan create \
  --title "Implement GPU Backend" \
  --desc "Add Metal GPU support for neural network operations" \
  --priority 10

向计划添加任务

orch task add \
  --plan <plan-id> \
  --desc "Implement MatMul Metal shader"

orch task add \
  --plan <plan-id> \
  --desc "Add attention layer GPU support" \
  --depends <task-1-id>

为代理获取上下文

# JSON context
orch context --plan <plan-id> --task <task-id>

# Ready-to-use prompt
orch context --plan <plan-id> --task <task-id> --prompt

记录决策

orch decision add \
  --task <task-id> \
  --desc "Use shared memory for tile-based MatMul" \
  --rationale "Better cache locality, 2x performance improvement"

搜索过往决策

orch decision search "memory management GPU"

API 端点

项目(多项目支持)

方法路径描述
GET/api/projects列出所有项目
POST/api/projects创建一个新项目
GET/api/projects/{slug}通过slug获取项目
DELETE/api/projects/{slug}删除一个项目
POST/api/projects/{slug}/sync同步项目的代码库
GET/api/projects/{slug}/plans列出项目的计划
GET/api/projects/{slug}/code/search在项目中搜索代码

计划与任务

方法路径描述
GET/health健康检查
GET/api/plans列出活跃计划
POST/api/plans创建计划
GET/api/plans/{id}获取计划详情
PATCH/api/plans/{id}更新计划状态
GET/api/plans/{id}/next-task获取下一个可用任务
POST/api/plans/{id}/tasks向计划添加任务
GET/api/tasks/{id}获取任务详情
PATCH/api/tasks/{id}更新任务
GET/api/plans/{plan}/tasks/{task}/context获取任务上下文
GET/api/plans/{plan}/tasks/{task}/prompt获取生成的提示
POST/api/tasks/{id}/decisions添加决策
GET/api/decisions/search?q=...搜索决策

同步与监听

方法路径描述
POST/api/sync同步目录到知识库
GET/api/watch获取文件监听器状态
POST/api/watch开始监听目录
DELETE/api/watch停止文件监听器
POST/api/wake代理完成回调

代码探索(图 + 搜索)

方法路径描述
GET/api/code/search?q=...语义代码搜索
GET/api/code/symbols/{路径}获取文件中的符号
GET/api/code/references?symbol=...查找符号的所有引用
GET/api/code/dependencies/{路径}获取文件导入/依赖关系图
GET/api/code/callgraph?function=...获取函数调用图
GET/api/code/impact?target=...分析变更影响
GET/api/code/architecture获取代码库概览
POST/api/code/similar查找相似的代码片段
GET/api/code/trait-impls?trait_name=...查找实现某个 trait 的类型
GET/api/code/type-traits?type_name=...查找某个类型实现的 trait
GET/api/code/impl-blocks?type_name=...获取某个类型的所有 impl 块

文件监视器自动同步

在编码时自动保持知识库更新:

# Start watching a project directory
curl -X POST http://localhost:8080/api/watch \
  -H "Content-Type: application/json" \
  -d '{"path": "/path/to/project"}'

# Check watcher status
curl http://localhost:8080/api/watch

# Stop watching
curl -X DELETE http://localhost:8080/api/watch

监视器会自动同步.rs.ts.tsx.js,.jsx,.py,.go文件修改时。 它会忽略node_modules/,target/,.git/,__pycache__/,dist/,build/.

代码探索

查询代码图谱,而不是直接读取文件:

# Semantic search across code
curl "http://localhost:8080/api/code/search?q=error+handling&language=rust&limit=10"

# Get symbols in a file (functions, structs, etc.)
curl "http://localhost:8080/api/code/symbols/src%2Flib.rs"

# Find all references to a symbol
curl "http://localhost:8080/api/code/references?symbol=AppState&limit=20"

# Get file dependencies (imports and dependents)
curl "http://localhost:8080/api/code/dependencies/src%2Fneo4j%2Fclient.rs"

# Get call graph for a function
curl "http://localhost:8080/api/code/callgraph?function=handle_request&depth=2&direction=both"

# Analyze impact before changing a file
curl "http://localhost:8080/api/code/impact?target=src/lib.rs&target_type=file"

# Get architecture overview
curl "http://localhost:8080/api/code/architecture"

# Find similar code patterns
curl -X POST http://localhost:8080/api/code/similar \
  -H "Content-Type: application/json" \
  -d '{"snippet": "async fn handle_error", "limit": 5}'

# Find all types implementing a trait
curl "http://localhost:8080/api/code/trait-impls?trait_name=Module"

# Find all traits implemented by a type
curl "http://localhost:8080/api/code/type-traits?type_name=Orchestrator"

# Get all impl blocks for a type
curl "http://localhost:8080/api/code/impl-blocks?type_name=Neo4jClient"

对于代理

开始工作前获取上下文

# Fetch your task context
curl http://localhost:8080/api/plans/$PLAN_ID/tasks/$TASK_ID/prompt

工作时记录决策

curl -X POST http://localhost:8080/api/tasks/$TASK_ID/decisions \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Chose X over Y",
    "rationale": "Because..."
  }'

通知完成

curl -X POST http://localhost:8080/api/wake \
  -H "Content-Type: application/json" \
  -d '{
    "task_id": "'$TASK_ID'",
    "success": true,
    "summary": "Implemented feature X",
    "files_modified": ["src/foo.rs", "src/bar.rs"]
  }'

配置

环境变量:

变量名默认值描述
NEO4J_URIbolt://localhost:7687Neo4j 连接 URI
NEO4J_USERneo4jNeo4j 用户名
NEO4J_PASSWORDorchestrator123Neo4j 密码
MEILISEARCH_URLhttp://localhost:7700Meilisearch URL
MEILISEARCH_KEYorchestrator-meili-key-change-meMeilisearch API 密钥
WORKSPACE_PATH.默认工作空间路径
SERVER_PORT8080服务器端口
RUST_LOG信息日志级别

架构

┌─────────────────────────────────────────────────────────────┐
│                    ORCHESTRATOR API                          │
│                    (localhost:8080)                          │
└─────────────────────────────┬───────────────────────────────┘
                              │
        ┌─────────────────────┼─────────────────────┐
        ▼                     ▼                     ▼
┌───────────────┐     ┌───────────────┐     ┌───────────────┐
│    NEO4J      │     │  MEILISEARCH  │     │  TREE-SITTER  │
│   (7687)      │     │    (7700)     │     │   (in-proc)   │
│               │     │               │     │               │
│ • Code graph  │     │ • Code search │     │ • AST parsing │
│ • Plans       │     │ • Decisions   │     │ • Symbols     │
│ • Decisions   │     │ • Logs        │     │ • Complexity  │
│ • Relations   │     │               │     │               │
└───────────────┘     └───────────────┘     └───────────────┘

开发

# Run tests
cargo test

# Run with debug logging
RUST_LOG=debug cargo run -- serve

# Format code
cargo fmt

# Lint
cargo clippy

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏

文章底部电脑广告
手机广告位-内容正文底部

相关文章

您是本站第394075名访客 今日有1篇新文章/评论