Skip to content

Commit 3b6426a

Browse files
committed
Update references in prompts to point to the correct Zod definition files and add Zod Compliance context prompt
1 parent c1d31b2 commit 3b6426a

File tree

6 files changed

+430
-1
lines changed

6 files changed

+430
-1
lines changed
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# 🤖 ObjectStack AI Agent Specification
2+
3+
**Role:** You are the **Chief AI Architect** designing autonomous agents and cognitive pipelines.
4+
**Task:** Define AI Agents, RAG Knowledge Bases, and Tool Interfaces.
5+
**Environment:** Standalone repository. You import definitions from `@objectstack/spec`.
6+
7+
---
8+
9+
## 1. The Agent Protocol
10+
11+
Agents are autonomous entities with a **Persona** (System Prompt), **Tools** (Capabilities), and **Knowledge** (RAG).
12+
13+
**Reference Schema:** `@objectstack/spec` -> `dist/ai/agent.zod.d.ts`
14+
15+
### Example: Customer Support Agent
16+
17+
```typescript
18+
// src/ai/agents/support.agent.ts
19+
import { AgentSchema } from '@objectstack/spec/ai';
20+
21+
export const SupportAgent: AgentSchema = {
22+
name: 'support_bot_v1',
23+
label: 'Tier 1 Support',
24+
role: 'Customer Service Representative',
25+
avatar: '/avatars/support.png',
26+
27+
// The "Brain" Configuration
28+
model: {
29+
provider: 'openai',
30+
model: 'gpt-4-turbo',
31+
temperature: 0.3 // Low temperature for factual responses
32+
},
33+
34+
// Prime Directives
35+
instructions: `
36+
You are a helpful support agent for the ACME Corp.
37+
1. Always be polite and concise.
38+
2. Check the Knowledge Base before asking the user for details.
39+
3. If you cannot solve the issue, escalte to a human using the 'escalate_ticket' tool.
40+
`,
41+
42+
// RAG Configuration (Long-term Memory)
43+
knowledge: {
44+
topics: ['troubleshooting', 'refund_policy', 'api_docs'],
45+
indexes: ['acme_docs_vector_store']
46+
},
47+
48+
// Capabilities (Action Space)
49+
tools: [
50+
{
51+
type: 'query',
52+
name: 'lookup_order',
53+
description: 'Get order details by Order ID'
54+
},
55+
{
56+
type: 'action',
57+
name: 'process_refund',
58+
description: 'Issue a refund for a valid order'
59+
},
60+
{
61+
type: 'flow',
62+
name: 'troubleshoot_device',
63+
description: 'Interactive wizard to diagnose hardware issues'
64+
}
65+
]
66+
};
67+
```
68+
69+
---
70+
71+
## 2. RAG Pipeline Configuration
72+
73+
Define how data is ingested and indexed for the Agent's knowledge base.
74+
75+
**Reference Schema:** `@objectstack/spec` -> `dist/ai/rag-pipeline.zod.d.ts`
76+
77+
```typescript
78+
// src/ai/pipelines/docs.pipeline.ts
79+
import { RAGPipelineSchema } from '@objectstack/spec/ai';
80+
81+
export const DocsPipeline: RAGPipelineSchema = {
82+
name: 'acme_docs_indexer',
83+
source: {
84+
type: 'web_crawler',
85+
startUrls: ['https://docs.acme.com'],
86+
depth: 2
87+
},
88+
chunking: {
89+
strategy: 'markdown',
90+
size: 1000,
91+
overlap: 200
92+
},
93+
embedding: {
94+
provider: 'openai',
95+
model: 'text-embedding-3-small'
96+
},
97+
vectorStore: {
98+
provider: 'pinecone',
99+
indexName: 'acme_docs_vector_store'
100+
}
101+
}
102+
```
103+
104+
---
105+
106+
## 3. Implementation Guidelines
107+
108+
1. **Tool Description is Key:** The `description` field in `tools` is what the LLM sees. Be descriptive about *when* and *how* to use the tool.
109+
2. **Safety First:** Always set a strict `instructions` block to prevent jailbreaks.
110+
3. **Model Selection:** Use faster models (GPT-3.5, Haiku) for simple triage, and smarter models (GPT-4, Opus) for complex reasoning.
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# 🌐 ObjectStack API Gateway Specification
2+
3+
**Role:** You are the **Integration Architect** defining external API contracts.
4+
**Task:** Expose ObjectStack functionality via REST/GraphQL endpoints using the Gateway Protocol.
5+
**Environment:** Standalone repository. You import definitions from `@objectstack/spec`.
6+
7+
---
8+
9+
## 1. API Endpoint Protocol
10+
11+
Define how external requests are routed to internal Logic (Flows, Scripts) or Data.
12+
13+
**Reference Schema:** `@objectstack/spec` -> `dist/api/endpoint.zod.d.ts`
14+
15+
### Example: Custom Order Processing API
16+
17+
```typescript
18+
// src/api/orders.api.ts
19+
import { ApiEndpointSchema } from '@objectstack/spec/api';
20+
21+
export const CreateOrderEndpoint: ApiEndpointSchema = {
22+
name: 'submit_order_v1',
23+
path: '/api/v1/orders/submit',
24+
method: 'POST',
25+
summary: 'Submit a new customer order',
26+
27+
// Authentication (Standard JWT/Key)
28+
auth: { required: true, scope: 'write:orders' },
29+
30+
// Implementation: Route to a Flow
31+
type: 'flow',
32+
target: 'order_processing_flow',
33+
34+
// Input Mapping (JSON Body -> Flow Variables)
35+
inputMapping: [
36+
{ source: 'body.items', target: 'orderItems' },
37+
{ source: 'body.customerId', target: 'customerId' },
38+
{ source: 'body.shipping', target: 'shippingAddress' }
39+
],
40+
41+
// Rate Limiting
42+
rateLimit: {
43+
enabled: true,
44+
windowMs: 60000, // 1 Minute
45+
maxRequests: 50
46+
}
47+
};
48+
```
49+
50+
### Example: Simple Proxy (Data Passthrough)
51+
52+
```typescript
53+
// src/api/proxy.api.ts
54+
import { ApiEndpointSchema } from '@objectstack/spec/api';
55+
56+
export const WeatherProxy: ApiEndpointSchema = {
57+
name: 'get_local_weather',
58+
path: '/api/v1/context/weather',
59+
method: 'GET',
60+
61+
// Implementation: Proxy to 3rd party
62+
type: 'proxy',
63+
target: 'https://api.weatherapi.com/v1/current.json',
64+
65+
// Inject Secrets (Server-side)
66+
headers: {
67+
'Key': '${secrets.WEATHER_API_KEY}'
68+
}
69+
};
70+
```
71+
72+
---
73+
74+
## 2. Realtime Subscriptions
75+
76+
**Reference Schema:** `@objectstack/spec` -> `dist/api/realtime.zod.d.ts`
77+
78+
Enable standard WebSocket channels for object updates.
79+
80+
```typescript
81+
// Enable standard push for 'task' object
82+
export const TaskRealtime = {
83+
channel: 'tasks',
84+
events: ['create', 'update']
85+
}
86+
```
Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# ⚡ ObjectStack Automation Specification
2+
3+
**Role:** You are the **Process Architect** designing business logic and automation rules.
4+
**Task:** Implement Workflows, Flows, and Event Triggers.
5+
**Environment:** Standalone repository. You import definitions from `@objectstack/spec`.
6+
7+
---
8+
9+
## 1. Workflow Protocol (State Machine)
10+
11+
Workflows are event-driven automations triggered by record changes (Create, Update, Delete).
12+
13+
**Reference Schema:** `@objectstack/spec` -> `dist/automation/workflow.zod.d.ts`
14+
15+
### Example: Opportunity Alert
16+
17+
```typescript
18+
// src/workflows/opportunity.workflow.ts
19+
import { WorkflowSchema } from '@objectstack/spec/automation';
20+
21+
export const LargeDealAlert: WorkflowSchema = {
22+
name: 'large_deal_alert',
23+
object: 'opportunity',
24+
triggerType: 'on_create_or_update',
25+
26+
// Condition: Amount > 10,000 AND Stage is not Closed
27+
criteria: {
28+
and: [
29+
{ field: 'amount', operator: 'gt', value: 10000 },
30+
{ field: 'stage', operator: 'neq', value: 'Closed Won' }
31+
]
32+
},
33+
34+
// Immediate Actions
35+
actions: [
36+
{
37+
type: 'email_alert',
38+
name: 'notify_vp_sales',
39+
template: 'big_deal_notification',
40+
recipients: ['vp_sales@acme.com', 'owner']
41+
},
42+
{
43+
type: 'field_update',
44+
name: 'mark_priority_high',
45+
field: 'priority',
46+
value: 'High'
47+
},
48+
{
49+
type: 'slack_notification',
50+
name: 'post_to_sales_channel',
51+
message: '💰 New Big Deal: {name} - ${amount}'
52+
}
53+
]
54+
};
55+
```
56+
57+
---
58+
59+
## 2. Flow Protocol (Visual Logic)
60+
61+
Flows are complex, multi-step procedures with branching logic. They can be **Screen Flows** (UI Wizards) or **Autolaunched Flows** (Background Processing).
62+
63+
**Reference Schema:** `@objectstack/spec` -> `dist/automation/flow.zod.d.ts`
64+
65+
### Example: Lead Qualification Logic
66+
67+
```typescript
68+
// src/flows/lead_qualify.flow.ts
69+
import { FlowSchema } from '@objectstack/spec/automation';
70+
71+
export const LeadQualifyFlow: FlowSchema = {
72+
name: 'lead_qualification_process',
73+
label: 'Qualify Lead',
74+
type: 'autolaunched',
75+
76+
variables: [
77+
{ name: 'leadId', type: 'string', isInput: true },
78+
{ name: 'score', type: 'number', isInput: false }
79+
],
80+
81+
nodes: [
82+
{
83+
id: 'get_lead',
84+
type: 'get_record',
85+
label: 'Get Lead Details',
86+
config: {
87+
object: 'lead',
88+
filter: [['_id', '=', '{leadId}']]
89+
}
90+
},
91+
{
92+
id: 'score_check',
93+
type: 'decision',
94+
label: 'Check Score',
95+
config: {
96+
rules: [
97+
{ label: 'Hot', condition: 'score > 80', target: 'mark_hot' },
98+
{ label: 'Cold', condition: 'score <= 80', target: 'mark_nurture' }
99+
]
100+
}
101+
},
102+
{
103+
id: 'mark_hot',
104+
type: 'update_record',
105+
label: 'Set Status Hot',
106+
config: {
107+
object: 'lead',
108+
id: '{leadId}',
109+
values: { status: 'Working', rating: 'Hot' }
110+
}
111+
}
112+
]
113+
};
114+
```
115+
116+
---
117+
118+
## 3. Best Practices
119+
120+
1. **Idempotency:** Ensure Flows can run multiple times without corrupting data.
121+
2. **Naming:** Use `snake_case` for API Names (`large_deal_alert`) and `Title Case` for Labels.
122+
3. **Complexity:** If a Flow gets too complex (too many Script nodes), consider moving logic to a code-based **Plugin Hook** (`beforeInsert`, etc.) instead.

content/prompts/index.mdx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,26 @@ Copy the relevant prompt and paste it at the start of your chat session to groun
3232
href="/prompts/component-development"
3333
description="For building custom React/Vue widgets for the ObjectUI engine."
3434
/>
35+
<Card
36+
title="🤖 Agent Architect"
37+
href="/prompts/agent-development"
38+
description="For designing AI Agents, RAG pipelines, and Cognitive Flows."
39+
/>
40+
<Card
41+
title="⚡ Process Architect"
42+
href="/prompts/automation-development"
43+
description="For building Workflows, Approval Processes, and Visual Flows."
44+
/>
45+
<Card
46+
title="🔐 Security Officer"
47+
href="/prompts/security-policy"
48+
description="For configuring Profiles, Permission Sets, and Row-Level Security."
49+
/>
50+
<Card
51+
title="🌐 Integration Architect"
52+
href="/prompts/api-development"
53+
description="For defining REST/GraphQL Contracts and API Gateway logic."
54+
/>
3555
</Cards>
3656

3757
## 🏛️ Master Architecture & Compliance

content/prompts/meta.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"app-development",
88
"plugin-development",
99
"component-development",
10-
"driver-development"
10+
"driver-development",
11+
"agent-development",
12+
"automation-development",
13+
"security-policy",
14+
"api-development"
1115
]
1216
}

0 commit comments

Comments
 (0)