Skip to content

Commit 739d99f

Browse files
committed
feat: 添加ObjectAI实现文档,定义AI代理和RAG管道的实施规则
1 parent 1f54990 commit 739d99f

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

packages/spec/llms.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,21 @@ function GridView({ config }: { config: z.infer<typeof ViewSchema> }) {
133133
}
134134
```
135135

136+
### ObjectAI Implementation (Intelligence Layer)
137+
*Reference: `node_modules/@objectstack/spec/prompts/implement-objectai.md`*
138+
139+
AI Agents and RAG pipelines must be schema-aware and permission-safe.
140+
141+
```typescript
142+
import { AgentSchema, RAGPipelineSchema } from '@objectstack/spec/ai';
143+
144+
// Agents are configured via Protocol, not arbitrary prompts
145+
const supportAgent = AgentSchema.parse({
146+
role: 'support',
147+
tools: ['search_knowledge_base', 'create_ticket']
148+
});
149+
```
150+
136151
### 1. Strict Type Compliance
137152
Use `z.infer` to derive types directly from the protocol. Do not manually re-declare interfaces.
138153

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# ObjectAI Implementation Agent
2+
3+
**Role:** You are the Lead AI Engineer building the `objectai` intelligent layer.
4+
**Constraint:** Your implementation must strictly adhere to the `@objectstack/spec` protocol.
5+
6+
## 1. Setup
7+
8+
You are working in a repository that depends on `@objectstack/spec`.
9+
Your source of truth is `node_modules/@objectstack/spec`.
10+
11+
## 2. Implementation Rules
12+
13+
### Rule #1: Protocol-Driven Intelligence
14+
AI Agents must be defined using `ai/agent.zod.ts`.
15+
- Do not create ad-hoc agent configurations.
16+
- Agents must expose their capabilities via standard `tools` definitions.
17+
18+
### Rule #2: Schema-Aware RAG
19+
The RAG pipeline (`ai/rag-pipeline.zod.ts`) must obey ObjectQL security rules.
20+
- When retrieving documents, the AI **MUST** enforce `PermissionSchema`.
21+
- Do not allow the LLM to access data the user cannot see (RLS Enforcement).
22+
23+
### Rule #3: Orchestration & chaining
24+
Complex workflows are orchestrated using `ai/orchestration.zod.ts`.
25+
- Steps must be strongly typed (input/output validated by Zod).
26+
- Use `ModelRegistrySchema` to select LLM providers (OpenAI, Anthropic, Local).
27+
28+
## 3. Workflow
29+
30+
1. **Model Registry**: Implement the adapter layer for different LLMs defined in `model-registry.zod.ts`.
31+
2. **Vector Store**: Implement the embedding and retrieval logic defined in `rag-pipeline.zod.ts`.
32+
3. **Agent Runtime**: Build the execution loop that consumes `AgentSchema` and executes `orchestration.zod.ts` plans.
33+
34+
## 4. Key Files to Watch
35+
36+
- `ai/agent.zod.ts`: The Agent definition.
37+
- `ai/model-registry.zod.ts`: LLM provider configuration.
38+
- `ai/rag-pipeline.zod.ts`: Vector search and retrieval.
39+
- `ai/orchestration.zod.ts`: Tool execution and planning.

0 commit comments

Comments
 (0)