mindrx 0.1.4 → 0.2.0

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