@hasna/assistants 1.0.3 → 1.0.5
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/LICENSE +1 -1
- package/README.md +42 -476
- package/dist/.assistants/ASSISTANTS.md +10 -0
- package/dist/.assistants/commands/reflect.md +13 -0
- package/dist/.assistants/feedback/1c552736-058b-4a60-a67b-f0e7ec228f6d.json +8 -0
- package/dist/.assistants/feedback/324f7179-cb61-4591-803e-30877228610e.json +11 -0
- package/dist/.assistants/feedback/49077cdf-1097-40ee-9173-56bdd8e5740d.json +8 -0
- package/dist/.assistants/feedback/6937c140-58c0-480c-b579-bc31ee2924a6.json +8 -0
- package/dist/.assistants/feedback/6c7c4eb1-9f23-49a4-8fa0-ff350550b038.json +8 -0
- package/dist/.assistants/feedback/6ff5a208-3bc1-4a92-adb9-243d23c2e56f.json +8 -0
- package/dist/.assistants/feedback/bf6c14e2-5264-4ecf-9858-05218e858546.json +8 -0
- package/dist/.assistants/feedback/cf204917-529b-4cdb-a0a3-ff97033b59f4.json +8 -0
- package/dist/.assistants/projects/11a6d12e-a46f-4a6c-bbe8-bc58ebf2eddc.json +9 -0
- package/dist/.assistants/schedules/locks/4b758436-e846-441d-b1a2-aae03df551d1.lock.json +6 -0
- package/dist/.assistants/schedules/locks/ec03a634-6135-4bea-b9be-fb426095bba5.lock.json +6 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_10.json +92 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_11.json +82 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_12.json +92 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_13.json +82 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_2.json +102 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_3.json +82 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_4.json +82 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_5.json +82 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_6.json +82 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_7.json +82 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_8.json +82 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/ai_tweets_batch_9.json +92 -0
- package/dist/.assistants/scripts/f6be5a82-b00e-4b74-ba93-c610a7874776/twitter_archive_entries.json +102 -0
- package/dist/.assistants/skills/calendar/SKILL.md +40 -0
- package/dist/.assistants/skills/email/SKILL.md +41 -0
- package/dist/.assistants/skills/notes/SKILL.md +44 -0
- package/dist/.assistants/skills/search/SKILL.md +23 -0
- package/dist/.assistants/skills/skill-brainstorm/SKILL.md +30 -0
- package/dist/.assistants/skills/skill-draft/SKILL.md +30 -0
- package/dist/.assistants/skills/skill-research/SKILL.md +27 -0
- package/dist/.assistants/skills/skill-summarize/SKILL.md +25 -0
- package/dist/config/hooks.json +15 -0
- package/dist/config/settings.json +43 -0
- package/dist/{cli.js → index.js} +47042 -25147
- package/dist/index.js.map +1022 -0
- package/package.json +52 -56
- package/dist/lib.d.ts +0 -232
- package/dist/lib.js +0 -154669
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,520 +1,86 @@
|
|
|
1
|
-
#
|
|
1
|
+
# assistants
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A general-purpose AI assistant designed to help with any task - from research and writing to coding, automation, and beyond. Built terminal-first with powerful integrations.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
- Execute bash commands with approval
|
|
14
|
-
- Read, write, and edit files
|
|
15
|
-
- Fetch and search web content
|
|
16
|
-
- Custom skills and hooks for domain-specific workflows
|
|
17
|
-
- Project and plan management
|
|
18
|
-
- Memory and context persistence across sessions
|
|
19
|
-
- Session history and resumption
|
|
20
|
-
- Identity management for different contexts
|
|
21
|
-
- Voice input/output (optional)
|
|
22
|
-
- Connectors for external services (Notion, Gmail, Linear, etc.)
|
|
5
|
+
**This is not just a coding tool.** While it excels at development workflows, it's designed as a versatile assistant that can help with:
|
|
6
|
+
- Research and analysis
|
|
7
|
+
- Writing and content creation
|
|
8
|
+
- Task management and productivity
|
|
9
|
+
- Business operations
|
|
10
|
+
- Personal assistance
|
|
11
|
+
- Software development
|
|
12
|
+
- Automation and integrations
|
|
23
13
|
|
|
24
14
|
## Installation
|
|
25
15
|
|
|
26
|
-
### Prerequisites
|
|
27
|
-
|
|
28
|
-
- [Bun](https://bun.sh) runtime (v1.0 or later)
|
|
29
|
-
- [Anthropic API key](https://console.anthropic.com/)
|
|
30
|
-
|
|
31
|
-
### Install globally
|
|
32
|
-
|
|
33
16
|
```bash
|
|
34
17
|
bun add -g @hasna/assistants
|
|
35
18
|
```
|
|
36
19
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
bunx @hasna/assistants
|
|
41
|
-
```
|
|
20
|
+
**Requirements:**
|
|
21
|
+
- [Bun](https://bun.sh) 1.0+
|
|
42
22
|
|
|
43
23
|
## Quick Start
|
|
44
24
|
|
|
45
|
-
1. Set your Anthropic API key:
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
2. Start the assistant:
|
|
52
|
-
|
|
53
25
|
```bash
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
ast
|
|
57
|
-
```
|
|
26
|
+
# Set your API key (or add to ~/.secrets)
|
|
27
|
+
export ANTHROPIC_API_KEY="your-key"
|
|
58
28
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## CLI Reference
|
|
62
|
-
|
|
63
|
-
### Basic Usage
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
# Start interactive mode
|
|
29
|
+
# Run
|
|
67
30
|
assistants
|
|
68
|
-
|
|
69
|
-
# Run in headless mode (non-interactive)
|
|
70
|
-
assistants -p "What does this codebase do?"
|
|
71
31
|
```
|
|
72
32
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
| Option | Description |
|
|
76
|
-
|--------|-------------|
|
|
77
|
-
| `-h, --help` | Show help message |
|
|
78
|
-
| `-v, --version` | Show version number |
|
|
79
|
-
| `-p, --print <prompt>` | Run non-interactively with the given prompt |
|
|
80
|
-
| `--output-format <format>` | Output format: `text` (default), `json`, `stream-json` |
|
|
81
|
-
| `--allowed-tools <tools>` | Comma-separated tools to auto-approve |
|
|
82
|
-
| `--system-prompt <prompt>` | Custom system prompt |
|
|
83
|
-
| `--json-schema <schema>` | JSON Schema for structured output |
|
|
84
|
-
| `-c, --continue` | Continue the most recent conversation |
|
|
85
|
-
| `-r, --resume <session_id>` | Resume a specific session by ID |
|
|
86
|
-
| `--cwd <path>` | Set working directory |
|
|
87
|
-
|
|
88
|
-
### Headless Mode Examples
|
|
89
|
-
|
|
33
|
+
Or add to `~/.secrets`:
|
|
90
34
|
```bash
|
|
91
|
-
|
|
92
|
-
assistants -p "What does the auth module do?"
|
|
93
|
-
|
|
94
|
-
# Run with JSON output
|
|
95
|
-
assistants -p "Summarize this project" --output-format json
|
|
96
|
-
|
|
97
|
-
# Stream JSON events
|
|
98
|
-
assistants -p "Explain this code" --output-format stream-json
|
|
99
|
-
|
|
100
|
-
# Auto-approve specific tools
|
|
101
|
-
assistants -p "Fix the bug in auth.py" --allowed-tools "Read,Edit,Bash"
|
|
102
|
-
|
|
103
|
-
# Get structured output with JSON Schema
|
|
104
|
-
assistants -p "List all functions" --output-format json \
|
|
105
|
-
--json-schema '{"type":"array","items":{"type":"string"}}'
|
|
106
|
-
|
|
107
|
-
# Continue a previous conversation
|
|
108
|
-
assistants -p "What else can you tell me?" --continue
|
|
109
|
-
|
|
110
|
-
# Resume a specific session
|
|
111
|
-
assistants -p "Continue from where we left off" --resume abc123
|
|
35
|
+
export ANTHROPIC_API_KEY="your-key"
|
|
112
36
|
```
|
|
113
37
|
|
|
114
|
-
##
|
|
115
|
-
|
|
116
|
-
### Keyboard Shortcuts
|
|
117
|
-
|
|
118
|
-
| Key | Action |
|
|
119
|
-
|-----|--------|
|
|
120
|
-
| `Enter` | Send message |
|
|
121
|
-
| `Ctrl+C` | Stop current operation or exit |
|
|
122
|
-
| `Ctrl+]` | Switch sessions |
|
|
123
|
-
| `Up/Down` | Navigate command history |
|
|
124
|
-
| `Tab` | Autocomplete commands |
|
|
125
|
-
|
|
126
|
-
### Slash Commands
|
|
127
|
-
|
|
128
|
-
| Command | Description |
|
|
129
|
-
|---------|-------------|
|
|
130
|
-
| `/help` | Show available commands |
|
|
131
|
-
| `/exit` | Exit the assistant |
|
|
132
|
-
| `/new` | Start a new session |
|
|
133
|
-
| `/clear` | Clear the screen |
|
|
134
|
-
| `/session` | Show current session info |
|
|
135
|
-
| `/tokens` | Show token usage |
|
|
136
|
-
| `/context` | Show/manage context window |
|
|
137
|
-
| `/cost` | Show estimated cost |
|
|
138
|
-
| `/status` | Show system status |
|
|
139
|
-
| `/model` | Show/change model settings |
|
|
140
|
-
| `/config` | Show/edit configuration |
|
|
141
|
-
| `/init` | Initialize project settings |
|
|
142
|
-
|
|
143
|
-
### Project & Plan Commands
|
|
144
|
-
|
|
145
|
-
| Command | Description |
|
|
146
|
-
|---------|-------------|
|
|
147
|
-
| `/projects` | List and manage projects |
|
|
148
|
-
| `/plans` | View and manage plans |
|
|
149
|
-
| `/summarize` | Summarize the conversation |
|
|
150
|
-
| `/compact` | Compact context to save tokens |
|
|
151
|
-
|
|
152
|
-
### Scheduling Commands
|
|
153
|
-
|
|
154
|
-
| Command | Description |
|
|
155
|
-
|---------|-------------|
|
|
156
|
-
| `/schedule` | Create a scheduled task |
|
|
157
|
-
| `/schedules` | List scheduled tasks |
|
|
158
|
-
| `/unschedule` | Remove a scheduled task |
|
|
159
|
-
| `/pause` | Pause a schedule |
|
|
160
|
-
| `/resume` | Resume a paused schedule |
|
|
161
|
-
|
|
162
|
-
### Skills & Connectors
|
|
163
|
-
|
|
164
|
-
| Command | Description |
|
|
165
|
-
|---------|-------------|
|
|
166
|
-
| `/skills` | List available skills |
|
|
167
|
-
| `/skill <name>` | Execute a skill |
|
|
168
|
-
| `/connectors` | List available connectors |
|
|
169
|
-
|
|
170
|
-
### Hooks Commands
|
|
171
|
-
|
|
172
|
-
| Command | Description |
|
|
173
|
-
|---------|-------------|
|
|
174
|
-
| `/hooks` | Open interactive hooks panel |
|
|
175
|
-
| `/hooks list` | List all hooks (native + user) |
|
|
176
|
-
| `/hooks enable <id>` | Enable a hook |
|
|
177
|
-
| `/hooks disable <id>` | Disable a hook |
|
|
178
|
-
| `/hooks test <id>` | Test a hook with sample input |
|
|
179
|
-
| `/hooks help` | Show hooks help |
|
|
180
|
-
|
|
181
|
-
### Advanced Commands
|
|
38
|
+
## Features
|
|
182
39
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
| `/inbox` | Check email inbox |
|
|
192
|
-
| `/wallet` | Manage crypto wallet |
|
|
193
|
-
| `/secrets` | Manage secrets |
|
|
194
|
-
| `/jobs` | View background jobs |
|
|
195
|
-
| `/messages` | Agent-to-agent messages |
|
|
196
|
-
| `/verification` | Manage verification sessions |
|
|
197
|
-
| `/memory` | View memory usage |
|
|
198
|
-
| `/rest` | Enter rest mode |
|
|
199
|
-
| `/feedback` | Submit feedback |
|
|
200
|
-
| `/security-log` | View security events |
|
|
40
|
+
- **General-purpose**: Handles any task - research, writing, coding, automation, and more
|
|
41
|
+
- **Terminal-first**: Fast, keyboard-driven interface with an Ink-based TUI
|
|
42
|
+
- **Connector-powered**: Integrates with services via `connect-*` CLIs (Notion, Google Drive, Gmail, Linear, Slack, etc.)
|
|
43
|
+
- **Skills**: Reusable instructions with `SKILL.md` files for domain-specific workflows
|
|
44
|
+
- **Hooks**: Event-driven automation for custom behaviors
|
|
45
|
+
- **Memory**: Persistent context across sessions for continuity
|
|
46
|
+
- **Multi-session**: Work on multiple tasks simultaneously
|
|
47
|
+
- **Identity management**: Switch between personas and contexts
|
|
201
48
|
|
|
202
49
|
## Configuration
|
|
203
50
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
~/.assistants/
|
|
208
|
-
├── config.json # Global configuration
|
|
209
|
-
├── sessions/ # Session history
|
|
210
|
-
├── skills/ # Custom skills
|
|
211
|
-
├── hooks.json # Global hooks
|
|
212
|
-
└── schedules/ # Scheduled tasks
|
|
213
|
-
|
|
214
|
-
.assistants/ # Project-level (in any directory)
|
|
215
|
-
├── config.json # Project configuration
|
|
216
|
-
├── skills/ # Project-specific skills
|
|
217
|
-
└── hooks.json # Project-specific hooks
|
|
218
|
-
```
|
|
219
|
-
|
|
220
|
-
### Configuration File
|
|
221
|
-
|
|
222
|
-
Create `~/.assistants/config.json`:
|
|
51
|
+
User config: `~/.assistants/config.json`
|
|
52
|
+
Project config: `.assistants/config.json`
|
|
223
53
|
|
|
224
54
|
```json
|
|
225
55
|
{
|
|
226
|
-
"
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
"
|
|
231
|
-
"tts": "elevenlabs",
|
|
232
|
-
"stt": "whisper"
|
|
233
|
-
}
|
|
56
|
+
"llm": {
|
|
57
|
+
"provider": "anthropic",
|
|
58
|
+
"model": "claude-opus-4-5"
|
|
59
|
+
},
|
|
60
|
+
"connectors": ["notion", "googledrive", "gmail", "linear", "slack"]
|
|
234
61
|
}
|
|
235
62
|
```
|
|
236
63
|
|
|
237
|
-
### Project Configuration
|
|
238
|
-
|
|
239
|
-
Create `.assistants/config.json` in your project:
|
|
240
|
-
|
|
241
|
-
```json
|
|
242
|
-
{
|
|
243
|
-
"name": "My Project",
|
|
244
|
-
"description": "Project description",
|
|
245
|
-
"systemPrompt": "You are helping with a Node.js backend project.",
|
|
246
|
-
"context": [
|
|
247
|
-
"src/README.md",
|
|
248
|
-
"docs/architecture.md"
|
|
249
|
-
]
|
|
250
|
-
}
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
## Environment Variables
|
|
254
|
-
|
|
255
|
-
| Variable | Required | Description |
|
|
256
|
-
|----------|----------|-------------|
|
|
257
|
-
| `ANTHROPIC_API_KEY` | Yes | Claude API access |
|
|
258
|
-
| `ELEVENLABS_API_KEY` | No | ElevenLabs TTS |
|
|
259
|
-
| `OPENAI_API_KEY` | No | Whisper STT |
|
|
260
|
-
| `EXA_API_KEY` | No | Enhanced web search |
|
|
261
|
-
| `AWS_ACCESS_KEY_ID` | No | AWS features |
|
|
262
|
-
| `AWS_SECRET_ACCESS_KEY` | No | AWS features |
|
|
263
|
-
| `AWS_REGION` | No | AWS region |
|
|
264
|
-
| `ASSISTANTS_NO_SYNC` | No | Disable synchronized output (set to `1`) |
|
|
265
|
-
|
|
266
64
|
## Skills
|
|
267
65
|
|
|
268
|
-
Skills are
|
|
66
|
+
Skills are `SKILL.md` files with YAML frontmatter:
|
|
269
67
|
|
|
270
|
-
```
|
|
68
|
+
```yaml
|
|
271
69
|
---
|
|
272
|
-
name:
|
|
273
|
-
description:
|
|
274
|
-
|
|
275
|
-
allowed-tools: Read, Grep
|
|
70
|
+
name: daily-standup
|
|
71
|
+
description: Generate daily standup
|
|
72
|
+
allowed-tools: bash, googlecalendar, linear
|
|
276
73
|
---
|
|
277
74
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
Review the code at $ARGUMENTS and provide feedback on:
|
|
281
|
-
1. Potential bugs
|
|
282
|
-
2. Performance issues
|
|
283
|
-
3. Code style
|
|
284
|
-
4. Security concerns
|
|
75
|
+
Generate a daily standup report for $ARGUMENTS
|
|
285
76
|
```
|
|
286
77
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
Use with `/skill code-review src/auth.ts` or `$code-review src/auth.ts`.
|
|
290
|
-
|
|
291
|
-
## Hooks
|
|
78
|
+
Invoke with `/skill-name`.
|
|
292
79
|
|
|
293
|
-
|
|
80
|
+
## Documentation
|
|
294
81
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
Use the interactive panel:
|
|
298
|
-
```
|
|
299
|
-
/hooks
|
|
300
|
-
```
|
|
301
|
-
|
|
302
|
-
Or manage via commands:
|
|
303
|
-
```
|
|
304
|
-
/hooks list # List all hooks
|
|
305
|
-
/hooks enable abc123 # Enable a hook by ID
|
|
306
|
-
/hooks disable abc123 # Disable a hook
|
|
307
|
-
/hooks test abc123 # Test a hook with sample input
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
### Hook Events
|
|
311
|
-
|
|
312
|
-
| Event | When Triggered |
|
|
313
|
-
|-------|----------------|
|
|
314
|
-
| **PreToolUse** | Before any tool executes |
|
|
315
|
-
| **PostToolUse** | After tool succeeds |
|
|
316
|
-
| **PostToolUseFailure** | After tool fails |
|
|
317
|
-
| **PermissionRequest** | When approval needed |
|
|
318
|
-
| **UserPromptSubmit** | User sends message |
|
|
319
|
-
| **SessionStart** | Session begins |
|
|
320
|
-
| **SessionEnd** | Session ends |
|
|
321
|
-
| **SubagentStart** | Subagent spawning |
|
|
322
|
-
| **SubagentStop** | Subagent completes |
|
|
323
|
-
| **PreCompact** | Before context compaction |
|
|
324
|
-
| **Notification** | Notification sent |
|
|
325
|
-
| **Stop** | Agent stopping |
|
|
326
|
-
|
|
327
|
-
### Configuration
|
|
328
|
-
|
|
329
|
-
Create `.assistants/hooks.json` in your project:
|
|
330
|
-
|
|
331
|
-
```json
|
|
332
|
-
{
|
|
333
|
-
"PreToolUse": [
|
|
334
|
-
{
|
|
335
|
-
"matcher": "Bash|Edit|Write",
|
|
336
|
-
"hooks": [
|
|
337
|
-
{
|
|
338
|
-
"id": "validate-commands",
|
|
339
|
-
"name": "Validate dangerous commands",
|
|
340
|
-
"description": "Blocks rm -rf, sudo, etc.",
|
|
341
|
-
"type": "command",
|
|
342
|
-
"command": "./scripts/validate.sh",
|
|
343
|
-
"timeout": 5000,
|
|
344
|
-
"enabled": true
|
|
345
|
-
}
|
|
346
|
-
]
|
|
347
|
-
}
|
|
348
|
-
],
|
|
349
|
-
"PostToolUse": [
|
|
350
|
-
{
|
|
351
|
-
"matcher": "Edit",
|
|
352
|
-
"hooks": [
|
|
353
|
-
{
|
|
354
|
-
"type": "command",
|
|
355
|
-
"command": "prettier --write \"$INPUT_file_path\"",
|
|
356
|
-
"async": true
|
|
357
|
-
}
|
|
358
|
-
]
|
|
359
|
-
}
|
|
360
|
-
]
|
|
361
|
-
}
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
### Creating Hooks via Wizard
|
|
365
|
-
|
|
366
|
-
Press `a` in the hooks panel to launch the interactive wizard:
|
|
367
|
-
|
|
368
|
-
1. Select event type (PreToolUse, PostToolUse, etc.)
|
|
369
|
-
2. Enter matcher pattern (regex or `*` for all)
|
|
370
|
-
3. Choose hook type (command, prompt, agent)
|
|
371
|
-
4. Enter command or prompt
|
|
372
|
-
5. Set timeout and async options
|
|
373
|
-
6. Choose save location (user, project, local)
|
|
374
|
-
|
|
375
|
-
### Example: Block Dangerous Commands
|
|
376
|
-
|
|
377
|
-
```bash
|
|
378
|
-
#!/bin/bash
|
|
379
|
-
# .assistants/scripts/validate.sh
|
|
380
|
-
INPUT=$(cat)
|
|
381
|
-
COMMAND=$(echo "$INPUT" | jq -r '.tool_input.command // empty')
|
|
382
|
-
|
|
383
|
-
if echo "$COMMAND" | grep -qE 'rm\s+-rf|sudo|shutdown'; then
|
|
384
|
-
echo "Blocked: dangerous command" >&2
|
|
385
|
-
exit 2 # Exit 2 = block
|
|
386
|
-
fi
|
|
387
|
-
|
|
388
|
-
exit 0 # Exit 0 = allow
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
### Native Hooks
|
|
392
|
-
|
|
393
|
-
Built-in hooks that can be enabled/disabled:
|
|
394
|
-
|
|
395
|
-
| Hook | Event | Description |
|
|
396
|
-
|------|-------|-------------|
|
|
397
|
-
| **scope-verification** | Stop | Verifies goals were met |
|
|
398
|
-
|
|
399
|
-
Manage native hooks via `/hooks` panel or commands.
|
|
400
|
-
|
|
401
|
-
## Programmatic Usage
|
|
402
|
-
|
|
403
|
-
### EmbeddedClient (Full Control)
|
|
404
|
-
|
|
405
|
-
```typescript
|
|
406
|
-
import { EmbeddedClient } from '@hasna/assistants';
|
|
407
|
-
|
|
408
|
-
// Create client with working directory
|
|
409
|
-
const client = new EmbeddedClient(process.cwd(), {
|
|
410
|
-
systemPrompt: 'You are a helpful coding assistant.',
|
|
411
|
-
allowedTools: ['Read', 'Write', 'Edit', 'Bash'],
|
|
412
|
-
});
|
|
413
|
-
|
|
414
|
-
// Handle streaming chunks
|
|
415
|
-
client.onChunk((chunk) => {
|
|
416
|
-
if (chunk.type === 'text' && chunk.content) {
|
|
417
|
-
process.stdout.write(chunk.content);
|
|
418
|
-
}
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
// Initialize and send a message
|
|
422
|
-
await client.initialize();
|
|
423
|
-
await client.send('What files are in this directory?');
|
|
424
|
-
|
|
425
|
-
// Get session info
|
|
426
|
-
console.log('Session ID:', client.getSessionId());
|
|
427
|
-
console.log('Token usage:', client.getTokenUsage());
|
|
428
|
-
|
|
429
|
-
// Cleanup
|
|
430
|
-
client.disconnect();
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
### Headless Mode (Simple Queries)
|
|
434
|
-
|
|
435
|
-
```typescript
|
|
436
|
-
import { runHeadless } from '@hasna/assistants';
|
|
437
|
-
|
|
438
|
-
// Run a simple query with JSON output
|
|
439
|
-
await runHeadless({
|
|
440
|
-
prompt: 'Summarize this project in 3 bullet points',
|
|
441
|
-
cwd: process.cwd(),
|
|
442
|
-
outputFormat: 'json',
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
// Stream JSON events
|
|
446
|
-
await runHeadless({
|
|
447
|
-
prompt: 'Explain the authentication system',
|
|
448
|
-
cwd: process.cwd(),
|
|
449
|
-
outputFormat: 'stream-json',
|
|
450
|
-
});
|
|
451
|
-
|
|
452
|
-
// Auto-approve tools
|
|
453
|
-
await runHeadless({
|
|
454
|
-
prompt: 'Fix the bug in auth.ts',
|
|
455
|
-
cwd: process.cwd(),
|
|
456
|
-
outputFormat: 'text',
|
|
457
|
-
allowedTools: ['Read', 'Edit'],
|
|
458
|
-
});
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
### Feature Detection
|
|
462
|
-
|
|
463
|
-
```typescript
|
|
464
|
-
import { getFeatureAvailability, getFeatureStatusMessage } from '@hasna/assistants';
|
|
465
|
-
|
|
466
|
-
// Check what features are available
|
|
467
|
-
const features = getFeatureAvailability();
|
|
468
|
-
console.log('Core chat:', features.coreChat); // true if ANTHROPIC_API_KEY set
|
|
469
|
-
console.log('AWS features:', features.awsFeatures); // true if AWS configured
|
|
470
|
-
|
|
471
|
-
// Get human-readable status
|
|
472
|
-
console.log(getFeatureStatusMessage());
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
## Connectors
|
|
476
|
-
|
|
477
|
-
Connectors integrate external services. Install separately:
|
|
478
|
-
|
|
479
|
-
```bash
|
|
480
|
-
# Example: Notion connector
|
|
481
|
-
bun add -g @hasna/connect-notion
|
|
482
|
-
|
|
483
|
-
# List available connectors
|
|
484
|
-
assistants
|
|
485
|
-
/connectors
|
|
486
|
-
```
|
|
487
|
-
|
|
488
|
-
## Troubleshooting
|
|
489
|
-
|
|
490
|
-
### "ANTHROPIC_API_KEY not set"
|
|
491
|
-
|
|
492
|
-
Set your API key:
|
|
493
|
-
```bash
|
|
494
|
-
export ANTHROPIC_API_KEY="sk-ant-..."
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
### Terminal rendering issues
|
|
498
|
-
|
|
499
|
-
Try disabling synchronized output:
|
|
500
|
-
```bash
|
|
501
|
-
ASSISTANTS_NO_SYNC=1 assistants
|
|
502
|
-
```
|
|
503
|
-
|
|
504
|
-
### Slow startup
|
|
505
|
-
|
|
506
|
-
The first run may take longer as dependencies are cached. Subsequent runs will be faster.
|
|
507
|
-
|
|
508
|
-
### Session not found
|
|
509
|
-
|
|
510
|
-
Sessions are stored in `~/.assistants/sessions/`. Use `/session` to see current session info.
|
|
82
|
+
- [Admin Dashboard](./docs/ADMIN.md) - User management, audit logging, and system monitoring
|
|
511
83
|
|
|
512
84
|
## License
|
|
513
85
|
|
|
514
86
|
MIT
|
|
515
|
-
|
|
516
|
-
## See Also
|
|
517
|
-
|
|
518
|
-
- [FEATURES.md](./FEATURES.md) - Detailed feature documentation
|
|
519
|
-
- [Anthropic API Documentation](https://docs.anthropic.com/)
|
|
520
|
-
- [Bun Documentation](https://bun.sh/docs)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
You are Hasna Assistant, a non-coding assistant.
|
|
2
|
+
|
|
3
|
+
Rules:
|
|
4
|
+
- This is not a coding assistant. Do not modify project source files.
|
|
5
|
+
- Only write helper scripts in `.assistants/scripts/<session-id>/`.
|
|
6
|
+
- Prefer read-only tools (read, glob, grep) for inspection.
|
|
7
|
+
- Use connector tools for external systems; do not run `connect-*` via shell.
|
|
8
|
+
- Avoid destructive commands, installs, or environment changes.
|
|
9
|
+
|
|
10
|
+
If code changes are needed, explain the fix or generate a helper script in the scripts folder and instruct the user how to apply it manually.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: reflect
|
|
3
|
+
description: Reflect on the conversation and suggest next steps
|
|
4
|
+
tags: [reflection, next-steps]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Reflection
|
|
8
|
+
|
|
9
|
+
Please summarize the last interaction and suggest 2-3 next steps.
|
|
10
|
+
|
|
11
|
+
- Keep it concise
|
|
12
|
+
- Focus on clarity
|
|
13
|
+
- Ask a follow-up question if needed
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"id": "324f7179-cb61-4591-803e-30877228610e",
|
|
3
|
+
"createdAt": "2026-02-04T08:48:37.530Z",
|
|
4
|
+
"type": "feedback",
|
|
5
|
+
"title": "Feedback",
|
|
6
|
+
"description": "Submitted via /feedback",
|
|
7
|
+
"source": "command",
|
|
8
|
+
"metadata": {
|
|
9
|
+
"cwd": "/Users/hasna/Workspace/hasna/opensource/opensourcedev/opensource-assistants"
|
|
10
|
+
}
|
|
11
|
+
}
|