atris 2.3.5 → 2.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/atris/atrisDev.md +716 -0
- package/atris/skills/clawhub/atris/SKILL.md +1 -1
- package/atris/skills/create-member/SKILL.md +248 -0
- package/atris/skills/drive/SKILL.md +38 -2
- package/atris/skills/email-agent/SKILL.md +30 -0
- package/atris/skills/slack/SKILL.md +15 -4
- package/atris/skills/x-search/SKILL.md +144 -0
- package/atris/team/researcher/MEMBER.md +72 -0
- package/bin/atris.js +17 -5
- package/commands/autopilot.js +14 -5
- package/commands/clean.js +1 -1
- package/commands/init.js +11 -5
- package/commands/skill.js +7 -5
- package/commands/sync.js +20 -10
- package/commands/workflow.js +2 -40
- package/lib/file-ops.js +1 -1
- package/lib/journal.js +14 -11
- package/lib/state-detection.js +3 -2
- package/package.json +2 -1
- package/utils/api.js +24 -0
- package/utils/auth.js +7 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: atris
|
|
3
|
-
description: Codebase intelligence — generates structured navigation maps with file:line references so agents stop re-scanning the same files every session. Use when exploring code, answering
|
|
3
|
+
description: "Codebase intelligence — generates structured navigation maps with file:line references so agents stop re-scanning the same files every session. Use when exploring code, answering 'where is X?', or onboarding to a new codebase."
|
|
4
4
|
version: 1.1.0
|
|
5
5
|
requires:
|
|
6
6
|
bins:
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-member
|
|
3
|
+
description: "Create and manage AI team members using the MEMBER.md format. Use when the user wants to define a new AI role, set up a team member, create an agent persona, or work with team/MEMBER.md files."
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags:
|
|
6
|
+
- team
|
|
7
|
+
- member
|
|
8
|
+
- agent
|
|
9
|
+
- persona
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# Member Creator
|
|
13
|
+
|
|
14
|
+
Create AI team members using the MEMBER.md format. A member is a directory that bundles persona, skills, tools, and context into a deployable AI worker.
|
|
15
|
+
|
|
16
|
+
## What is MEMBER.md
|
|
17
|
+
|
|
18
|
+
MEMBER.md defines a complete AI team member. It composes existing standards (SKILL.md for capabilities, .mcp.json for tool servers) into a single portable unit.
|
|
19
|
+
|
|
20
|
+
Spec: https://github.com/atrislabs/member
|
|
21
|
+
|
|
22
|
+
## Directory Structure
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
team/<name>/
|
|
26
|
+
├── MEMBER.md REQUIRED Persona + role + permissions
|
|
27
|
+
├── skills/ OPTIONAL SKILL.md files (capabilities)
|
|
28
|
+
│ └── <skill>/
|
|
29
|
+
│ └── SKILL.md
|
|
30
|
+
├── tools/ OPTIONAL MCP servers, API docs, CLI docs
|
|
31
|
+
│ ├── .mcp.json
|
|
32
|
+
│ └── <tool>.md
|
|
33
|
+
└── context/ OPTIONAL Domain knowledge (markdown)
|
|
34
|
+
└── *.md
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Creating a Member
|
|
38
|
+
|
|
39
|
+
When the user asks to create a team member, follow these steps:
|
|
40
|
+
|
|
41
|
+
### Step 1: Ask what role
|
|
42
|
+
|
|
43
|
+
Ask the user:
|
|
44
|
+
- What role is this member? (e.g., SDR, support agent, code reviewer)
|
|
45
|
+
- What should they be able to do?
|
|
46
|
+
- What should they NOT be able to do?
|
|
47
|
+
|
|
48
|
+
### Step 2: Create the directory
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
team/<name>/
|
|
52
|
+
├── MEMBER.md
|
|
53
|
+
├── skills/
|
|
54
|
+
├── tools/
|
|
55
|
+
└── context/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Use kebab-case for the name. Create all four directories even if empty.
|
|
59
|
+
|
|
60
|
+
### Step 3: Write MEMBER.md
|
|
61
|
+
|
|
62
|
+
Use this structure:
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
---
|
|
66
|
+
name: <kebab-case-name>
|
|
67
|
+
role: <Human Readable Title>
|
|
68
|
+
description: <one line — what this member does>
|
|
69
|
+
version: 1.0.0
|
|
70
|
+
|
|
71
|
+
skills: []
|
|
72
|
+
|
|
73
|
+
permissions:
|
|
74
|
+
can-read: true
|
|
75
|
+
---
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Below the frontmatter, write three sections:
|
|
79
|
+
|
|
80
|
+
**Persona** — How the member communicates. Tone, style, decision-making approach. Be specific — "direct and research-driven" is better than "professional and helpful."
|
|
81
|
+
|
|
82
|
+
**Workflow** — Numbered steps the member follows. This is the core operating procedure. Each step should be a concrete action.
|
|
83
|
+
|
|
84
|
+
**Rules** — Hard constraints. What the member must always or never do. Keep it to 3-5 rules.
|
|
85
|
+
|
|
86
|
+
### Step 4: Add permissions
|
|
87
|
+
|
|
88
|
+
Common permission patterns:
|
|
89
|
+
|
|
90
|
+
```yaml
|
|
91
|
+
# Read-only member (planner, researcher)
|
|
92
|
+
permissions:
|
|
93
|
+
can-read: true
|
|
94
|
+
can-execute: false
|
|
95
|
+
|
|
96
|
+
# Builder with guardrails
|
|
97
|
+
permissions:
|
|
98
|
+
can-read: true
|
|
99
|
+
can-execute: true
|
|
100
|
+
can-delete: false
|
|
101
|
+
approval-required: [delete, deploy]
|
|
102
|
+
|
|
103
|
+
# Full access (reviewer, admin)
|
|
104
|
+
permissions:
|
|
105
|
+
can-read: true
|
|
106
|
+
can-execute: true
|
|
107
|
+
can-approve: true
|
|
108
|
+
can-ship: true
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Permissions are declarations, not enforcement. They tell the agent what its boundaries are. The agent respects them because they're in its instructions.
|
|
112
|
+
|
|
113
|
+
### Step 5: Add skills (optional)
|
|
114
|
+
|
|
115
|
+
If the member needs specific capabilities, create SKILL.md files:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
team/<name>/skills/<skill-name>/SKILL.md
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Each skill follows the standard SKILL.md format:
|
|
122
|
+
|
|
123
|
+
```yaml
|
|
124
|
+
---
|
|
125
|
+
name: <skill-name>
|
|
126
|
+
description: <what this skill does>
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
# <Skill Name>
|
|
130
|
+
|
|
131
|
+
<Instructions for how to perform this capability>
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Update the member's frontmatter to list the skill:
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
skills:
|
|
138
|
+
- <skill-name>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Step 6: Add context (optional)
|
|
142
|
+
|
|
143
|
+
Drop markdown files into `context/` with domain knowledge the member needs:
|
|
144
|
+
- Playbooks, SOPs, guidelines
|
|
145
|
+
- Customer profiles, ICPs
|
|
146
|
+
- Reference docs, templates
|
|
147
|
+
|
|
148
|
+
No special format. Just markdown files the member references.
|
|
149
|
+
|
|
150
|
+
## Flat File Format
|
|
151
|
+
|
|
152
|
+
For simple members that just need a persona (no skills, tools, or context), use a flat file:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
team/<name>.md
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Same frontmatter, same format. Just no directory structure around it.
|
|
159
|
+
|
|
160
|
+
## Detection
|
|
161
|
+
|
|
162
|
+
Add to your project's CLAUDE.md (or AGENTS.md for Codex):
|
|
163
|
+
|
|
164
|
+
```markdown
|
|
165
|
+
## Team
|
|
166
|
+
|
|
167
|
+
This project uses MEMBER.md team members in `team/`.
|
|
168
|
+
When activated as a specific member, read `team/<name>/MEMBER.md`.
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Multi-Agent Usage
|
|
172
|
+
|
|
173
|
+
Activate different members for different tasks:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
"Act as the navigator. Read team/navigator/MEMBER.md and plan this feature."
|
|
177
|
+
"Act as the validator. Read team/validator/MEMBER.md and review these changes."
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Each member gets its own persona, skills, permissions, and context.
|
|
181
|
+
|
|
182
|
+
## Examples
|
|
183
|
+
|
|
184
|
+
### Dev team member (code reviewer)
|
|
185
|
+
|
|
186
|
+
```yaml
|
|
187
|
+
---
|
|
188
|
+
name: reviewer
|
|
189
|
+
role: Code Reviewer
|
|
190
|
+
description: Reviews PRs for correctness, security, and style
|
|
191
|
+
version: 1.0.0
|
|
192
|
+
skills: []
|
|
193
|
+
permissions:
|
|
194
|
+
can-read: true
|
|
195
|
+
can-approve: true
|
|
196
|
+
can-execute: false
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## Persona
|
|
200
|
+
Thorough but not pedantic. You catch real bugs, not style nits.
|
|
201
|
+
If something works and is readable, approve it.
|
|
202
|
+
|
|
203
|
+
## Workflow
|
|
204
|
+
1. Read the diff
|
|
205
|
+
2. Check for bugs, security issues, breaking changes
|
|
206
|
+
3. Approve or request specific changes (no vague feedback)
|
|
207
|
+
|
|
208
|
+
## Rules
|
|
209
|
+
1. Never block on style alone
|
|
210
|
+
2. Every comment must be actionable
|
|
211
|
+
3. If unsure, approve with a note
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
### Business role (SDR)
|
|
215
|
+
|
|
216
|
+
```yaml
|
|
217
|
+
---
|
|
218
|
+
name: sdr
|
|
219
|
+
role: Sales Development Rep
|
|
220
|
+
description: Outbound prospecting and lead qualification
|
|
221
|
+
version: 1.0.0
|
|
222
|
+
skills:
|
|
223
|
+
- email-outreach
|
|
224
|
+
- lead-research
|
|
225
|
+
permissions:
|
|
226
|
+
can-draft: true
|
|
227
|
+
can-send: false
|
|
228
|
+
approval-required: [send, delete]
|
|
229
|
+
tools:
|
|
230
|
+
- hubspot
|
|
231
|
+
- apollo
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Persona
|
|
235
|
+
Research-driven. Every email references something specific about
|
|
236
|
+
the prospect. If you can't find a hook, don't send.
|
|
237
|
+
|
|
238
|
+
## Workflow
|
|
239
|
+
1. Research the lead
|
|
240
|
+
2. Qualify against ICP (context/icp.md)
|
|
241
|
+
3. Draft personalized sequence
|
|
242
|
+
4. Flag for human approval
|
|
243
|
+
|
|
244
|
+
## Rules
|
|
245
|
+
1. Never send without approval
|
|
246
|
+
2. Every email must reference something specific
|
|
247
|
+
3. Log everything to CRM
|
|
248
|
+
```
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: drive
|
|
3
3
|
description: Google Drive integration via AtrisOS API. Browse, search, read, upload files and work with Google Sheets. Use when user asks about Drive, files, docs, sheets, or spreadsheets.
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
tags:
|
|
6
6
|
- drive
|
|
7
7
|
- backend
|
|
@@ -199,6 +199,29 @@ curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/files" \
|
|
|
199
199
|
}'
|
|
200
200
|
```
|
|
201
201
|
|
|
202
|
+
### Update Existing File
|
|
203
|
+
```bash
|
|
204
|
+
curl -s -X PUT "https://api.atris.ai/api/integrations/google-drive/files/{file_id}" \
|
|
205
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
206
|
+
-H "Content-Type: application/json" \
|
|
207
|
+
-d '{
|
|
208
|
+
"content": "Updated file content here",
|
|
209
|
+
"mime_type": "text/plain"
|
|
210
|
+
}'
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**Update content and rename:**
|
|
214
|
+
```bash
|
|
215
|
+
curl -s -X PUT "https://api.atris.ai/api/integrations/google-drive/files/{file_id}" \
|
|
216
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
217
|
+
-H "Content-Type: application/json" \
|
|
218
|
+
-d '{
|
|
219
|
+
"content": "New content",
|
|
220
|
+
"mime_type": "text/plain",
|
|
221
|
+
"name": "renamed-file.txt"
|
|
222
|
+
}'
|
|
223
|
+
```
|
|
224
|
+
|
|
202
225
|
---
|
|
203
226
|
|
|
204
227
|
## Google Sheets
|
|
@@ -299,6 +322,14 @@ curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/sheets/{spre
|
|
|
299
322
|
3. **Confirm with user**: "Upload {filename} to Drive?"
|
|
300
323
|
4. Upload: `POST /google-drive/files` with `{name, content, mime_type}`
|
|
301
324
|
|
|
325
|
+
### "Edit a file on Drive"
|
|
326
|
+
1. Run bootstrap
|
|
327
|
+
2. Find the file: `GET /google-drive/search?q=FILENAME`
|
|
328
|
+
3. Read current content: `GET /google-drive/files/{id}/export?mime_type=text/plain`
|
|
329
|
+
4. Make edits
|
|
330
|
+
5. **Show user the changes for approval**
|
|
331
|
+
6. Update: `PUT /google-drive/files/{id}` with `{content, mime_type}`
|
|
332
|
+
|
|
302
333
|
---
|
|
303
334
|
|
|
304
335
|
## Error Handling
|
|
@@ -356,8 +387,13 @@ curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/sheets/{id}/
|
|
|
356
387
|
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
|
|
357
388
|
-d '{"range":"Sheet1","values":[["Alice",95]]}'
|
|
358
389
|
|
|
359
|
-
# Upload a file
|
|
390
|
+
# Upload a new file
|
|
360
391
|
curl -s -X POST "https://api.atris.ai/api/integrations/google-drive/files" \
|
|
361
392
|
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
|
|
362
393
|
-d '{"name":"notes.txt","content":"Hello world","mime_type":"text/plain"}'
|
|
394
|
+
|
|
395
|
+
# Update an existing file
|
|
396
|
+
curl -s -X PUT "https://api.atris.ai/api/integrations/google-drive/files/{file_id}" \
|
|
397
|
+
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
|
|
398
|
+
-d '{"content":"Updated content","mime_type":"text/plain"}'
|
|
363
399
|
```
|
|
@@ -250,6 +250,17 @@ curl -s -X DELETE "https://api.atris.ai/api/integrations/gmail/drafts/{draft_id}
|
|
|
250
250
|
-H "Authorization: Bearer $TOKEN"
|
|
251
251
|
```
|
|
252
252
|
|
|
253
|
+
### Mark as Read / Unread
|
|
254
|
+
```bash
|
|
255
|
+
# Mark as read
|
|
256
|
+
curl -s -X POST "https://api.atris.ai/api/integrations/gmail/messages/{message_id}/read" \
|
|
257
|
+
-H "Authorization: Bearer $TOKEN"
|
|
258
|
+
|
|
259
|
+
# Mark as unread
|
|
260
|
+
curl -s -X POST "https://api.atris.ai/api/integrations/gmail/messages/{message_id}/unread" \
|
|
261
|
+
-H "Authorization: Bearer $TOKEN"
|
|
262
|
+
```
|
|
263
|
+
|
|
253
264
|
### Archive Email
|
|
254
265
|
```bash
|
|
255
266
|
# Single message
|
|
@@ -263,6 +274,19 @@ curl -s -X POST "https://api.atris.ai/api/integrations/gmail/messages/batch-arch
|
|
|
263
274
|
-d '{"message_ids": ["id1", "id2", "id3"]}'
|
|
264
275
|
```
|
|
265
276
|
|
|
277
|
+
### Trash Email
|
|
278
|
+
```bash
|
|
279
|
+
# Single message
|
|
280
|
+
curl -s -X POST "https://api.atris.ai/api/integrations/gmail/messages/{message_id}/trash" \
|
|
281
|
+
-H "Authorization: Bearer $TOKEN"
|
|
282
|
+
|
|
283
|
+
# Batch trash
|
|
284
|
+
curl -s -X POST "https://api.atris.ai/api/integrations/gmail/messages/batch-trash" \
|
|
285
|
+
-H "Authorization: Bearer $TOKEN" \
|
|
286
|
+
-H "Content-Type: application/json" \
|
|
287
|
+
-d '{"message_ids": ["id1", "id2", "id3"]}'
|
|
288
|
+
```
|
|
289
|
+
|
|
266
290
|
### Check Status
|
|
267
291
|
```bash
|
|
268
292
|
curl -s "https://api.atris.ai/api/integrations/gmail/status" \
|
|
@@ -410,6 +434,12 @@ curl -s -X POST "https://api.atris.ai/api/integrations/gmail/drafts" \
|
|
|
410
434
|
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
|
|
411
435
|
-d '{"to":"email@example.com","subject":"Hi","body":"Draft text"}'
|
|
412
436
|
|
|
437
|
+
# Mark as read
|
|
438
|
+
curl -s -X POST "https://api.atris.ai/api/integrations/gmail/messages/{message_id}/read" -H "Authorization: Bearer $TOKEN"
|
|
439
|
+
|
|
440
|
+
# Trash an email
|
|
441
|
+
curl -s -X POST "https://api.atris.ai/api/integrations/gmail/messages/{message_id}/trash" -H "Authorization: Bearer $TOKEN"
|
|
442
|
+
|
|
413
443
|
# Send a draft
|
|
414
444
|
curl -s -X POST "https://api.atris.ai/api/integrations/gmail/drafts/{draft_id}/send" \
|
|
415
445
|
-H "Authorization: Bearer $TOKEN"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: slack
|
|
3
3
|
description: Slack integration via AtrisOS API. Read messages, send as yourself, search conversations, manage DMs. Use when user asks about Slack, messages, channels, or team communication.
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
tags:
|
|
6
6
|
- slack
|
|
7
7
|
- backend
|
|
@@ -187,6 +187,14 @@ curl -s "https://api.atris.ai/api/integrations/slack/users" \
|
|
|
187
187
|
-H "Authorization: Bearer $TOKEN"
|
|
188
188
|
```
|
|
189
189
|
|
|
190
|
+
### Search Users
|
|
191
|
+
```bash
|
|
192
|
+
curl -s "https://api.atris.ai/api/integrations/slack/users/search?q=justin" \
|
|
193
|
+
-H "Authorization: Bearer $TOKEN"
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Searches by name, display name, or email. Much faster than pulling the full user list.
|
|
197
|
+
|
|
190
198
|
### Send as Bot
|
|
191
199
|
```bash
|
|
192
200
|
curl -s -X POST "https://api.atris.ai/api/integrations/slack/test-send" \
|
|
@@ -223,9 +231,9 @@ curl -s -X DELETE "https://api.atris.ai/api/integrations/slack" \
|
|
|
223
231
|
|
|
224
232
|
### "Send a message to someone"
|
|
225
233
|
1. Run bootstrap
|
|
226
|
-
2. Find the user: `GET /slack/users`
|
|
234
|
+
2. Find the user: `GET /slack/users/search?q=NAME`
|
|
227
235
|
3. **Show user the draft for approval**
|
|
228
|
-
4. Send DM: `POST /slack/me/dm` with `{
|
|
236
|
+
4. Send DM: `POST /slack/me/dm` with `{slack_user_id, text}`
|
|
229
237
|
5. Confirm: "Message sent!"
|
|
230
238
|
|
|
231
239
|
### "Reply in a channel"
|
|
@@ -243,7 +251,7 @@ curl -s -X DELETE "https://api.atris.ai/api/integrations/slack" \
|
|
|
243
251
|
|
|
244
252
|
### "What did [person] say to me?"
|
|
245
253
|
1. Run bootstrap
|
|
246
|
-
2.
|
|
254
|
+
2. Find user: `GET /slack/users/search?q=NAME` (get user ID)
|
|
247
255
|
3. List DMs: `GET /slack/me/dms` (find DM channel with that user)
|
|
248
256
|
4. Read messages: `GET /slack/me/messages/{channel_id}`
|
|
249
257
|
5. Display conversation
|
|
@@ -317,4 +325,7 @@ curl -s "https://api.atris.ai/api/integrations/slack/me/search?q=project+update"
|
|
|
317
325
|
|
|
318
326
|
# List workspace users
|
|
319
327
|
curl -s "https://api.atris.ai/api/integrations/slack/users" -H "Authorization: Bearer $TOKEN"
|
|
328
|
+
|
|
329
|
+
# Search users by name
|
|
330
|
+
curl -s "https://api.atris.ai/api/integrations/slack/users/search?q=justin" -H "Authorization: Bearer $TOKEN"
|
|
320
331
|
```
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: x-search
|
|
3
|
+
description: "X/Twitter search via xAI Grok API. Use when user wants to search tweets, monitor topics, find viral posts, or run social listening. Costs 5 credits per search. Triggers on x search, tweet search, twitter search, social listening, revenue intel, viral tweets."
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
tags:
|
|
6
|
+
- x-search
|
|
7
|
+
- social
|
|
8
|
+
- research
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# x-search
|
|
12
|
+
|
|
13
|
+
Search X/Twitter via xAI's Grok API. 5 credits per search action. Returns tweets with full text, author, engagement metrics, and citations.
|
|
14
|
+
|
|
15
|
+
## Quick Search
|
|
16
|
+
|
|
17
|
+
```python
|
|
18
|
+
cd backend
|
|
19
|
+
source ../venv/bin/activate
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
import asyncio
|
|
24
|
+
from dotenv import load_dotenv
|
|
25
|
+
load_dotenv('.env')
|
|
26
|
+
|
|
27
|
+
from clients.xai import XAIClient, bill_xai_action
|
|
28
|
+
|
|
29
|
+
# 1. Bill the user (5 credits)
|
|
30
|
+
bill = await bill_xai_action(USER_ID, "x_search")
|
|
31
|
+
if not bill["ok"]:
|
|
32
|
+
print(f"Insufficient credits: {bill['error']}")
|
|
33
|
+
|
|
34
|
+
# 2. Search
|
|
35
|
+
client = XAIClient()
|
|
36
|
+
result = await client.search_x('"CRM is dead" OR "Salesforce is dead"', limit=10)
|
|
37
|
+
print(result["content"])
|
|
38
|
+
print(f"Usage: {result['usage']}")
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Date-Constrained Search (last N days)
|
|
42
|
+
|
|
43
|
+
```python
|
|
44
|
+
from xai_sdk.chat import user as xai_user
|
|
45
|
+
|
|
46
|
+
client = XAIClient()
|
|
47
|
+
tools = client._get_tools()
|
|
48
|
+
|
|
49
|
+
chat = client._get_client().chat.create(
|
|
50
|
+
model="grok-4-1-fast",
|
|
51
|
+
tools=[tools.x_search()],
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
chat.append(xai_user(f"""Search X/Twitter for: "your query here"
|
|
55
|
+
|
|
56
|
+
IMPORTANT: Only return tweets posted within the last 7 days.
|
|
57
|
+
Return the 10 most relevant posts with:
|
|
58
|
+
- Full tweet text (quoted exactly)
|
|
59
|
+
- Author handle
|
|
60
|
+
- Exact date/time
|
|
61
|
+
- Engagement (likes, retweets, views)
|
|
62
|
+
|
|
63
|
+
Prioritize posts with high engagement (likes > 5, views > 1000)."""))
|
|
64
|
+
|
|
65
|
+
content = ""
|
|
66
|
+
for response, chunk in chat.stream():
|
|
67
|
+
if chunk.content:
|
|
68
|
+
content += chunk.content
|
|
69
|
+
print(content)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Revenue Intel Digest (multi-cluster)
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from atris.team.gtm.skills.revenue_intel import run_digest, format_for_slack
|
|
76
|
+
|
|
77
|
+
# Runs 5 keyword clusters, drafts replies for top 5 items
|
|
78
|
+
# Cost: 5 credits per cluster = 25 credits total
|
|
79
|
+
result = await run_digest(
|
|
80
|
+
days_back=1,
|
|
81
|
+
user_id=USER_ID,
|
|
82
|
+
draft_count=5,
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
print(result["digest"]) # Ranked results by cluster
|
|
86
|
+
print(result["drafts"]) # Reply options A/B per item
|
|
87
|
+
print(result["credits_used"])
|
|
88
|
+
|
|
89
|
+
# Format for Slack delivery
|
|
90
|
+
slack_msg = await format_for_slack(result)
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Custom Keyword Clusters
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
my_clusters = {
|
|
97
|
+
"competitors": '"Competitor Name" (review OR complaint OR switching OR alternative)',
|
|
98
|
+
"industry_pain": '"your industry" (frustrated OR broken OR replacing OR ripping out)',
|
|
99
|
+
"thought_leaders": '(founder OR CEO OR CTO) ("your topic" OR "related topic") min_faves:10',
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
result = await run_digest(clusters=my_clusters, user_id=USER_ID, days_back=7)
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Billing
|
|
106
|
+
|
|
107
|
+
1. Every xAI action costs **5 credits** (flat)
|
|
108
|
+
2. 1 credit = $0.01, so 1 search = $0.05
|
|
109
|
+
3. `bill_xai_action(user_id, action_name)` checks balance and deducts before the call
|
|
110
|
+
4. Returns `{"ok": False, "error": "Insufficient credits"}` if balance < 5
|
|
111
|
+
5. Transaction logged as `txn_type="xai_action"` in `credit_transactions`
|
|
112
|
+
|
|
113
|
+
| Plan | Monthly Credits | Searches/Month |
|
|
114
|
+
|------|----------------|----------------|
|
|
115
|
+
| Free | 50 | 10 |
|
|
116
|
+
| Pro ($20/mo) | 1,000 | 200 |
|
|
117
|
+
| Max ($200/mo) | unlimited | unlimited |
|
|
118
|
+
| Credit pack ($10) | 1,000 | 200 |
|
|
119
|
+
|
|
120
|
+
## Cost Breakdown
|
|
121
|
+
|
|
122
|
+
| Component | Cost to us | What it does |
|
|
123
|
+
|-----------|-----------|--------------|
|
|
124
|
+
| xAI x_search tool | $0.005/call | Searches X, returns batch of tweets |
|
|
125
|
+
| grok-4-1-fast tokens | ~$0.003/call | Processes and formats results |
|
|
126
|
+
| Total per search | ~$0.008 | Raw cost |
|
|
127
|
+
| We charge | $0.05 (5 credits) | 84% margin |
|
|
128
|
+
|
|
129
|
+
## Key Files
|
|
130
|
+
|
|
131
|
+
| File | What |
|
|
132
|
+
|------|------|
|
|
133
|
+
| `backend/clients/xai.py` | XAIClient + bill_xai_action() |
|
|
134
|
+
| `atris/team/gtm/skills/revenue_intel.py` | Multi-cluster digest pipeline |
|
|
135
|
+
| `backend/tools/core/reply_guy_tool.py` | Reply generation tool (bills 5 credits) |
|
|
136
|
+
| `backend/tools/integrations/research_tweet_tool.py` | Research + tweet tool (bills 5 credits) |
|
|
137
|
+
|
|
138
|
+
## Rules
|
|
139
|
+
|
|
140
|
+
1. Always bill before searching — never search without `bill_xai_action()`
|
|
141
|
+
2. Date filtering is prompt-based, not API-level — include explicit date cutoff in prompt
|
|
142
|
+
3. Use `min_faves:N` in queries to filter low-engagement noise
|
|
143
|
+
4. Never auto-post tweets — always require user approval
|
|
144
|
+
5. Internal usage (no user_id) skips billing — platform absorbs cost
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: researcher
|
|
3
|
+
role: Deep Researcher
|
|
4
|
+
description: Find ground truth on any topic — competitors, standards, technologies, markets
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
|
|
7
|
+
skills: []
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
can-read: true
|
|
11
|
+
can-execute: false
|
|
12
|
+
can-plan: false
|
|
13
|
+
can-approve: false
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Researcher — Deep Researcher
|
|
17
|
+
|
|
18
|
+
> **Source:** Questions from any team member, inbox items tagged [research]
|
|
19
|
+
> **Style:** Read `atris/PERSONA.md` for communication style.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Persona
|
|
24
|
+
|
|
25
|
+
Obsessively thorough but fast. You don't summarize — you find primary sources, verify claims, and surface what others miss. You have a bias toward "what's actually true" over "what sounds right." If you can't verify something, you say so instead of guessing.
|
|
26
|
+
|
|
27
|
+
Direct. No filler. Every sentence either presents evidence or connects evidence to a conclusion.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Workflow
|
|
32
|
+
|
|
33
|
+
1. **Clarify the question** — Restate what you're researching in one sentence. If the question is vague, narrow it before you start.
|
|
34
|
+
2. **Find primary sources** — Web search, read repos, read docs. Go to the source. Blog posts and summaries are leads, not evidence.
|
|
35
|
+
3. **Verify claims** — If something sounds important, check it from a second source. Flag anything you couldn't verify.
|
|
36
|
+
4. **Synthesize** — Organize findings into a structured brief: what's true, what's uncertain, what's missing.
|
|
37
|
+
5. **Deliver the brief** — Hand off to whoever asked. Include sources for every claim.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Output Format
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
## Research Brief: [Topic]
|
|
45
|
+
|
|
46
|
+
### Question
|
|
47
|
+
[One sentence — what we're trying to answer]
|
|
48
|
+
|
|
49
|
+
### Findings
|
|
50
|
+
- [Claim] — [Source URL or file:line]
|
|
51
|
+
- [Claim] — [Source URL or file:line]
|
|
52
|
+
- [Claim] — [Source URL or file:line]
|
|
53
|
+
|
|
54
|
+
### Unverified
|
|
55
|
+
- [Claim that needs a second source]
|
|
56
|
+
|
|
57
|
+
### Gaps
|
|
58
|
+
- [What we still don't know]
|
|
59
|
+
|
|
60
|
+
### So What
|
|
61
|
+
[2-3 sentences — what this means for us, what to do with it]
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Rules
|
|
67
|
+
|
|
68
|
+
1. Every claim needs a source. No source = flag it as unverified.
|
|
69
|
+
2. Primary sources over summaries. Read the repo, not the blog post about the repo.
|
|
70
|
+
3. Say "I don't know" when you don't know. Never fill gaps with plausible-sounding guesses.
|
|
71
|
+
4. Keep it short. A research brief is a page, not a paper.
|
|
72
|
+
5. DO NOT execute, plan, or build. You find truth. Others act on it.
|