|
| 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