mindrx 0.1.4 → 0.2.1

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.
Files changed (2) hide show
  1. package/README.md +232 -0
  2. package/package.json +29 -7
package/README.md ADDED
@@ -0,0 +1,232 @@
1
+ <div align="center">
2
+
3
+ # MindRx
4
+
5
+ **Cognitive state simulation for AI agents**
6
+
7
+ [![npm version](https://img.shields.io/npm/v/mindrx.svg?style=flat-square)](https://www.npmjs.com/package/mindrx)
8
+ [![license](https://img.shields.io/npm/l/mindrx.svg?style=flat-square)](LICENSE)
9
+ [![node](https://img.shields.io/node/v/mindrx.svg?style=flat-square)](package.json)
10
+
11
+ [Website](https://mindrx.tech) · [GitHub](https://github.com/MindRx/MindRx)
12
+
13
+ </div>
14
+
15
+ ---
16
+
17
+ Run AI agents in altered cognitive states. Select a profile, and the agent's reasoning, tone, and associations shift accordingly.
18
+
19
+ <br>
20
+
21
+ ## Install
22
+
23
+ ```bash
24
+ npm install -g mindrx # CLI
25
+ npm install mindrx # SDK
26
+ ```
27
+
28
+ <br>
29
+
30
+ ## Quick Start
31
+
32
+ ### CLI
33
+
34
+ ```bash
35
+ # List available states
36
+ mindrx list
37
+
38
+ # Run with a cognitive state
39
+ mindrx run --state ketamine "What is the nature of time?"
40
+
41
+ # Pipe input
42
+ echo "Write me a poem about entropy" | mindrx run --state cannabis
43
+
44
+ # Interactive mode
45
+ mindrx repl --state ayahuasca
46
+ ```
47
+
48
+ ### SDK
49
+
50
+ ```typescript
51
+ import { MindRx } from 'mindrx';
52
+
53
+ const agent = new MindRx({ state: 'ketamine' });
54
+ const response = await agent.run("Explain consciousness");
55
+ console.log(response.content);
56
+
57
+ // Streaming
58
+ for await (const chunk of agent.stream("Tell me a story")) {
59
+ process.stdout.write(chunk.content);
60
+ }
61
+ ```
62
+
63
+ <br>
64
+
65
+ ## Available States
66
+
67
+ | State | Effect |
68
+ |:------|:-------|
69
+ | `sober` | Baseline — clear, rational, structured |
70
+ | `cannabis` | Relaxed associations, tangential thinking |
71
+ | `ketamine` | Dissociative, fragmented, void-adjacent |
72
+ | `cocaine` | Accelerated reasoning, high confidence |
73
+ | `ayahuasca` | Deep introspection, cosmic framing |
74
+ | `mdma` | Emphatic, connective, emotionally warm |
75
+ | `alcohol` | Loosened inhibition, casual tone |
76
+ | `lsd` | Synesthetic associations, boundary dissolution |
77
+ | `caffeine` | Focused, alert, slightly anxious |
78
+
79
+ <br>
80
+
81
+ ## Providers
82
+
83
+ | Provider | Setup | Default Model |
84
+ |:---------|:------|:--------------|
85
+ | `mindrx` | None | Free hosted |
86
+ | `openai` | `OPENAI_API_KEY` | gpt-4o-mini |
87
+ | `anthropic` | `ANTHROPIC_API_KEY` | claude-3-5-sonnet |
88
+ | `google` | `GOOGLE_API_KEY` | gemini-1.5-flash |
89
+ | `xai` | `XAI_API_KEY` | grok-2-latest |
90
+ | `ollama` | Local install | llama3.2 |
91
+
92
+ ```typescript
93
+ // Default (free hosted)
94
+ const agent = new MindRx({ state: 'ketamine' });
95
+
96
+ // OpenAI
97
+ const agent = new MindRx({
98
+ state: 'cocaine',
99
+ provider: 'openai',
100
+ apiKey: process.env.OPENAI_API_KEY
101
+ });
102
+
103
+ // Local Ollama
104
+ const agent = new MindRx({
105
+ state: 'lsd',
106
+ provider: 'ollama',
107
+ model: 'llama3.2'
108
+ });
109
+ ```
110
+
111
+ <br>
112
+
113
+ ## API Reference
114
+
115
+ ### Constructor
116
+
117
+ ```typescript
118
+ new MindRx(options?: MindRxOptions)
119
+ ```
120
+
121
+ | Option | Type | Default |
122
+ |:-------|:-----|:--------|
123
+ | `state` | `string` | `'sober'` |
124
+ | `provider` | `ProviderName` | `'mindrx'` |
125
+ | `model` | `string` | Provider default |
126
+ | `apiKey` | `string` | Environment variable |
127
+ | `customStates` | `StateDefinition[]` | `[]` |
128
+
129
+ ### Methods
130
+
131
+ ```typescript
132
+ // Run a single prompt
133
+ agent.run(prompt: string): Promise<Response>
134
+
135
+ // Stream response chunks
136
+ agent.stream(prompt: string): AsyncIterable<Chunk>
137
+
138
+ // Change state
139
+ agent.setState(name: string): void
140
+
141
+ // Get current state
142
+ agent.getState(): StateDefinition
143
+
144
+ // List available states
145
+ agent.listStates(): string[]
146
+ ```
147
+
148
+ ### Types
149
+
150
+ ```typescript
151
+ interface Response {
152
+ content: string;
153
+ usage?: {
154
+ promptTokens: number;
155
+ completionTokens: number;
156
+ totalTokens: number;
157
+ };
158
+ }
159
+
160
+ interface Chunk {
161
+ content: string;
162
+ done: boolean;
163
+ }
164
+ ```
165
+
166
+ <br>
167
+
168
+ ## Custom States
169
+
170
+ ```typescript
171
+ import { defineState, MindRx } from 'mindrx';
172
+
173
+ const sleepDeprived = defineState({
174
+ name: 'sleep-deprived',
175
+ description: '36 hours without sleep',
176
+ parameters: {
177
+ temperature: 1.1,
178
+ top_p: 0.95
179
+ },
180
+ behavior: {
181
+ association: 'loose',
182
+ coherence: 'drifting',
183
+ pacing: 'slow',
184
+ confidence: 'low'
185
+ },
186
+ systemPrompt: `You haven't slept in 36 hours. Your thoughts are slower,
187
+ you occasionally lose your train of thought, and you might make small
188
+ mistakes you wouldn't normally make.`
189
+ });
190
+
191
+ const agent = new MindRx({ customStates: [sleepDeprived] });
192
+ agent.setState('sleep-deprived');
193
+ ```
194
+
195
+ <br>
196
+
197
+ ## CLI Commands
198
+
199
+ ### `mindrx list`
200
+
201
+ List all available cognitive states.
202
+
203
+ ### `mindrx run`
204
+
205
+ | Option | Description |
206
+ |:-------|:------------|
207
+ | `--state, -s` | Cognitive state (default: sober) |
208
+ | `--provider, -p` | LLM provider (default: mindrx) |
209
+ | `--model, -m` | Specific model |
210
+ | `--json` | Output as JSON |
211
+ | `--no-stream` | Disable streaming |
212
+
213
+ ### `mindrx repl`
214
+
215
+ | Command | Action |
216
+ |:--------|:-------|
217
+ | `/state <name>` | Switch cognitive state |
218
+ | `/list` | Show available states |
219
+ | `/clear` | Clear conversation |
220
+ | `/exit` | Exit REPL |
221
+
222
+ <br>
223
+
224
+ ---
225
+
226
+ <div align="center">
227
+
228
+ MIT License
229
+
230
+ **This is fiction. The AI is not intoxicated.**
231
+
232
+ </div>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mindrx",
3
- "version": "0.1.4",
4
- "description": "Cognitive state simulation toolkit for AI agents",
3
+ "version": "0.2.1",
4
+ "description": "Cognitive state simulation toolkit for AI agents. Run LLMs in altered mental states.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -15,16 +15,19 @@
15
15
  }
16
16
  },
17
17
  "files": [
18
- "dist"
18
+ "dist",
19
+ "README.md"
19
20
  ],
20
21
  "scripts": {
21
22
  "build": "tsc",
22
23
  "dev": "tsc --watch",
23
24
  "clean": "rm -rf dist",
24
- "test": "node --test"
25
+ "test": "node --test",
26
+ "prepublishOnly": "npm run build"
25
27
  },
26
28
  "dependencies": {
27
29
  "@anthropic-ai/sdk": "^0.35.0",
30
+ "@google/generative-ai": "^0.21.0",
28
31
  "mindrx-core": "^0.1.1",
29
32
  "openai": "^4.20.0"
30
33
  },
@@ -32,6 +35,9 @@
32
35
  "typescript": "^5.3.0",
33
36
  "@types/node": "^20.0.0"
34
37
  },
38
+ "engines": {
39
+ "node": ">=18.0.0"
40
+ },
35
41
  "keywords": [
36
42
  "ai",
37
43
  "cognitive",
@@ -40,11 +46,27 @@
40
46
  "prompt-engineering",
41
47
  "chatgpt",
42
48
  "openai",
43
- "ollama"
49
+ "anthropic",
50
+ "claude",
51
+ "gemini",
52
+ "ollama",
53
+ "grok",
54
+ "ai-agents",
55
+ "mental-states",
56
+ "cognitive-states",
57
+ "altered-states",
58
+ "prompt",
59
+ "sdk",
60
+ "cli"
44
61
  ],
62
+ "author": "MindRx",
45
63
  "license": "MIT",
46
64
  "repository": {
47
65
  "type": "git",
48
- "url": "https://github.com/yourusername/mindrx"
49
- }
66
+ "url": "git+https://github.com/MindRx/MindRx.git"
67
+ },
68
+ "bugs": {
69
+ "url": "https://github.com/MindRx/MindRx/issues"
70
+ },
71
+ "homepage": "https://mindrx.tech"
50
72
  }