mastra-minds 0.1.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.
@@ -0,0 +1,9 @@
1
+ import { type Mind } from "./types";
2
+ /**
3
+ * Parse a MIND.md file content into a Mind object
4
+ */
5
+ export declare function parseMindMd(content: string, baseDir: string): Mind;
6
+ /**
7
+ * Load and parse a mind from a directory
8
+ */
9
+ export declare function loadMind(mindDir: string): Promise<Mind>;
@@ -0,0 +1,39 @@
1
+ import type { Mind, MindMetadata } from "./types";
2
+ /**
3
+ * MindRegistry manages mind discovery and loading
4
+ * Implements progressive disclosure: metadata loaded upfront, full content on-demand
5
+ */
6
+ export declare class MindRegistry {
7
+ private mindsDir;
8
+ private metadataCache;
9
+ private mindCache;
10
+ constructor(mindsDir: string);
11
+ /**
12
+ * Discover all minds and load their metadata (Level 1: ~100 tokens each)
13
+ */
14
+ discover(): Promise<MindMetadata[]>;
15
+ /**
16
+ * Get mind metadata by name
17
+ */
18
+ getMetadata(name: string): MindMetadata | undefined;
19
+ /**
20
+ * Load full mind content (Level 2: <5000 tokens)
21
+ */
22
+ loadMind(name: string): Promise<Mind | undefined>;
23
+ /**
24
+ * Generate available minds list for system prompt injection
25
+ */
26
+ generateAvailableMinds(): string;
27
+ /** @deprecated Use generateAvailableMinds() instead */
28
+ generateAvailableMindsXml(): string;
29
+ /**
30
+ * List all available mind names
31
+ */
32
+ listMinds(): string[];
33
+ /**
34
+ * Check if a mind exists
35
+ */
36
+ hasMind(name: string): boolean;
37
+ }
38
+ export declare function getMindRegistry(mindsDir?: string): MindRegistry;
39
+ export declare function initMindRegistry(mindsDir: string): Promise<MindRegistry>;
@@ -0,0 +1,259 @@
1
+ import { z } from "zod";
2
+ /**
3
+ * Mind Loader Tool - Core of the prompt injection system
4
+ * When invoked, loads the full mind content and returns it for the agent to follow
5
+ */
6
+ export declare const loadMindTool: import("@mastra/core/tools").Tool<z.ZodObject<{
7
+ name: z.ZodString;
8
+ }, z.core.$strip>, z.ZodObject<{
9
+ success: z.ZodBoolean;
10
+ mindName: z.ZodOptional<z.ZodString>;
11
+ instructions: z.ZodOptional<z.ZodString>;
12
+ baseDir: z.ZodOptional<z.ZodString>;
13
+ allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ message: z.ZodOptional<z.ZodString>;
15
+ }, z.core.$strip>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "load-mind"> & {
16
+ inputSchema: z.ZodObject<{
17
+ name: z.ZodString;
18
+ }, z.core.$strip>;
19
+ outputSchema: z.ZodObject<{
20
+ success: z.ZodBoolean;
21
+ mindName: z.ZodOptional<z.ZodString>;
22
+ instructions: z.ZodOptional<z.ZodString>;
23
+ baseDir: z.ZodOptional<z.ZodString>;
24
+ allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
+ message: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$strip>;
27
+ execute: (inputData: {
28
+ name: string;
29
+ }, context?: import("@mastra/core/tools").ToolExecutionContext<any, any> | undefined) => Promise<{
30
+ success: boolean;
31
+ mindName?: string | undefined;
32
+ instructions?: string | undefined;
33
+ baseDir?: string | undefined;
34
+ allowedTools?: string[] | undefined;
35
+ message?: string | undefined;
36
+ } & {
37
+ error?: never;
38
+ }>;
39
+ };
40
+ /**
41
+ * Read Mind Resource Tool - For loading references/scripts on-demand (Level 3)
42
+ */
43
+ export declare const readMindResourceTool: import("@mastra/core/tools").Tool<z.ZodObject<{
44
+ mindName: z.ZodString;
45
+ resourcePath: z.ZodString;
46
+ }, z.core.$strip>, z.ZodObject<{
47
+ success: z.ZodBoolean;
48
+ content: z.ZodOptional<z.ZodString>;
49
+ message: z.ZodOptional<z.ZodString>;
50
+ }, z.core.$strip>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "read-mind-resource"> & {
51
+ inputSchema: z.ZodObject<{
52
+ mindName: z.ZodString;
53
+ resourcePath: z.ZodString;
54
+ }, z.core.$strip>;
55
+ outputSchema: z.ZodObject<{
56
+ success: z.ZodBoolean;
57
+ content: z.ZodOptional<z.ZodString>;
58
+ message: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strip>;
60
+ execute: (inputData: {
61
+ mindName: string;
62
+ resourcePath: string;
63
+ }, context?: import("@mastra/core/tools").ToolExecutionContext<any, any> | undefined) => Promise<{
64
+ success: boolean;
65
+ content?: string | undefined;
66
+ message?: string | undefined;
67
+ } & {
68
+ error?: never;
69
+ }>;
70
+ };
71
+ /**
72
+ * Execute Mind Script Tool - Run scripts from mind's scripts/ directory
73
+ * V1: Direct execution without sandbox (development only)
74
+ */
75
+ export declare const executeMindScriptTool: import("@mastra/core/tools").Tool<z.ZodObject<{
76
+ mindName: z.ZodString;
77
+ scriptPath: z.ZodString;
78
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
+ }, z.core.$strip>, z.ZodObject<{
80
+ success: z.ZodBoolean;
81
+ stdout: z.ZodOptional<z.ZodString>;
82
+ stderr: z.ZodOptional<z.ZodString>;
83
+ exitCode: z.ZodOptional<z.ZodNumber>;
84
+ message: z.ZodOptional<z.ZodString>;
85
+ }, z.core.$strip>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "execute-mind-script"> & {
86
+ inputSchema: z.ZodObject<{
87
+ mindName: z.ZodString;
88
+ scriptPath: z.ZodString;
89
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
90
+ }, z.core.$strip>;
91
+ outputSchema: z.ZodObject<{
92
+ success: z.ZodBoolean;
93
+ stdout: z.ZodOptional<z.ZodString>;
94
+ stderr: z.ZodOptional<z.ZodString>;
95
+ exitCode: z.ZodOptional<z.ZodNumber>;
96
+ message: z.ZodOptional<z.ZodString>;
97
+ }, z.core.$strip>;
98
+ execute: (inputData: {
99
+ mindName: string;
100
+ scriptPath: string;
101
+ args?: string[] | undefined;
102
+ }, context?: import("@mastra/core/tools").ToolExecutionContext<any, any> | undefined) => Promise<{
103
+ success: boolean;
104
+ stdout?: string | undefined;
105
+ stderr?: string | undefined;
106
+ exitCode?: number | undefined;
107
+ message?: string | undefined;
108
+ } & {
109
+ error?: never;
110
+ }>;
111
+ };
112
+ /**
113
+ * List Minds Tool - Show available minds
114
+ */
115
+ export declare const listMindsTool: import("@mastra/core/tools").Tool<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
116
+ minds: z.ZodArray<z.ZodObject<{
117
+ name: z.ZodString;
118
+ description: z.ZodString;
119
+ }, z.core.$strip>>;
120
+ }, z.core.$strip>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "list-minds"> & {
121
+ inputSchema: z.ZodObject<{}, z.core.$strip>;
122
+ outputSchema: z.ZodObject<{
123
+ minds: z.ZodArray<z.ZodObject<{
124
+ name: z.ZodString;
125
+ description: z.ZodString;
126
+ }, z.core.$strip>>;
127
+ }, z.core.$strip>;
128
+ execute: (inputData: Record<string, never>, context?: import("@mastra/core/tools").ToolExecutionContext<any, any> | undefined) => Promise<{
129
+ minds: {
130
+ name: string;
131
+ description: string;
132
+ }[];
133
+ } & {
134
+ error?: never;
135
+ }>;
136
+ };
137
+ export declare const mindTools: {
138
+ loadMindTool: import("@mastra/core/tools").Tool<z.ZodObject<{
139
+ name: z.ZodString;
140
+ }, z.core.$strip>, z.ZodObject<{
141
+ success: z.ZodBoolean;
142
+ mindName: z.ZodOptional<z.ZodString>;
143
+ instructions: z.ZodOptional<z.ZodString>;
144
+ baseDir: z.ZodOptional<z.ZodString>;
145
+ allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
146
+ message: z.ZodOptional<z.ZodString>;
147
+ }, z.core.$strip>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "load-mind"> & {
148
+ inputSchema: z.ZodObject<{
149
+ name: z.ZodString;
150
+ }, z.core.$strip>;
151
+ outputSchema: z.ZodObject<{
152
+ success: z.ZodBoolean;
153
+ mindName: z.ZodOptional<z.ZodString>;
154
+ instructions: z.ZodOptional<z.ZodString>;
155
+ baseDir: z.ZodOptional<z.ZodString>;
156
+ allowedTools: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
+ message: z.ZodOptional<z.ZodString>;
158
+ }, z.core.$strip>;
159
+ execute: (inputData: {
160
+ name: string;
161
+ }, context?: import("@mastra/core/tools").ToolExecutionContext<any, any> | undefined) => Promise<{
162
+ success: boolean;
163
+ mindName?: string | undefined;
164
+ instructions?: string | undefined;
165
+ baseDir?: string | undefined;
166
+ allowedTools?: string[] | undefined;
167
+ message?: string | undefined;
168
+ } & {
169
+ error?: never;
170
+ }>;
171
+ };
172
+ readMindResourceTool: import("@mastra/core/tools").Tool<z.ZodObject<{
173
+ mindName: z.ZodString;
174
+ resourcePath: z.ZodString;
175
+ }, z.core.$strip>, z.ZodObject<{
176
+ success: z.ZodBoolean;
177
+ content: z.ZodOptional<z.ZodString>;
178
+ message: z.ZodOptional<z.ZodString>;
179
+ }, z.core.$strip>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "read-mind-resource"> & {
180
+ inputSchema: z.ZodObject<{
181
+ mindName: z.ZodString;
182
+ resourcePath: z.ZodString;
183
+ }, z.core.$strip>;
184
+ outputSchema: z.ZodObject<{
185
+ success: z.ZodBoolean;
186
+ content: z.ZodOptional<z.ZodString>;
187
+ message: z.ZodOptional<z.ZodString>;
188
+ }, z.core.$strip>;
189
+ execute: (inputData: {
190
+ mindName: string;
191
+ resourcePath: string;
192
+ }, context?: import("@mastra/core/tools").ToolExecutionContext<any, any> | undefined) => Promise<{
193
+ success: boolean;
194
+ content?: string | undefined;
195
+ message?: string | undefined;
196
+ } & {
197
+ error?: never;
198
+ }>;
199
+ };
200
+ executeMindScriptTool: import("@mastra/core/tools").Tool<z.ZodObject<{
201
+ mindName: z.ZodString;
202
+ scriptPath: z.ZodString;
203
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
204
+ }, z.core.$strip>, z.ZodObject<{
205
+ success: z.ZodBoolean;
206
+ stdout: z.ZodOptional<z.ZodString>;
207
+ stderr: z.ZodOptional<z.ZodString>;
208
+ exitCode: z.ZodOptional<z.ZodNumber>;
209
+ message: z.ZodOptional<z.ZodString>;
210
+ }, z.core.$strip>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "execute-mind-script"> & {
211
+ inputSchema: z.ZodObject<{
212
+ mindName: z.ZodString;
213
+ scriptPath: z.ZodString;
214
+ args: z.ZodOptional<z.ZodArray<z.ZodString>>;
215
+ }, z.core.$strip>;
216
+ outputSchema: z.ZodObject<{
217
+ success: z.ZodBoolean;
218
+ stdout: z.ZodOptional<z.ZodString>;
219
+ stderr: z.ZodOptional<z.ZodString>;
220
+ exitCode: z.ZodOptional<z.ZodNumber>;
221
+ message: z.ZodOptional<z.ZodString>;
222
+ }, z.core.$strip>;
223
+ execute: (inputData: {
224
+ mindName: string;
225
+ scriptPath: string;
226
+ args?: string[] | undefined;
227
+ }, context?: import("@mastra/core/tools").ToolExecutionContext<any, any> | undefined) => Promise<{
228
+ success: boolean;
229
+ stdout?: string | undefined;
230
+ stderr?: string | undefined;
231
+ exitCode?: number | undefined;
232
+ message?: string | undefined;
233
+ } & {
234
+ error?: never;
235
+ }>;
236
+ };
237
+ listMindsTool: import("@mastra/core/tools").Tool<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
238
+ minds: z.ZodArray<z.ZodObject<{
239
+ name: z.ZodString;
240
+ description: z.ZodString;
241
+ }, z.core.$strip>>;
242
+ }, z.core.$strip>, any, any, import("@mastra/core/tools").ToolExecutionContext<any, any>, "list-minds"> & {
243
+ inputSchema: z.ZodObject<{}, z.core.$strip>;
244
+ outputSchema: z.ZodObject<{
245
+ minds: z.ZodArray<z.ZodObject<{
246
+ name: z.ZodString;
247
+ description: z.ZodString;
248
+ }, z.core.$strip>>;
249
+ }, z.core.$strip>;
250
+ execute: (inputData: Record<string, never>, context?: import("@mastra/core/tools").ToolExecutionContext<any, any> | undefined) => Promise<{
251
+ minds: {
252
+ name: string;
253
+ description: string;
254
+ }[];
255
+ } & {
256
+ error?: never;
257
+ }>;
258
+ };
259
+ };
@@ -0,0 +1,20 @@
1
+ import { z } from "zod";
2
+ export declare const MindFrontmatterSchema: z.ZodObject<{
3
+ name: z.ZodString;
4
+ description: z.ZodString;
5
+ license: z.ZodOptional<z.ZodString>;
6
+ compatibility: z.ZodOptional<z.ZodString>;
7
+ "allowed-tools": z.ZodOptional<z.ZodString>;
8
+ model: z.ZodOptional<z.ZodString>;
9
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
10
+ }, z.core.$strip>;
11
+ export type MindFrontmatter = z.infer<typeof MindFrontmatterSchema>;
12
+ export interface Mind {
13
+ frontmatter: MindFrontmatter;
14
+ content: string;
15
+ baseDir: string;
16
+ }
17
+ export interface MindMetadata {
18
+ name: string;
19
+ description: string;
20
+ }
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "mastra-minds",
3
+ "version": "0.1.1",
4
+ "description": "Agent Minds system for Mastra - Claude-style skills with progressive disclosure",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "scripts": {
19
+ "build": "bun build ./src/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly",
20
+ "typecheck": "tsc --noEmit",
21
+ "test": "bun test"
22
+ },
23
+ "peerDependencies": {
24
+ "@mastra/core": ">=1.0.0-beta.0",
25
+ "ai": ">=3.0.0",
26
+ "zod": ">=3.0.0"
27
+ },
28
+ "devDependencies": {
29
+ "@mastra/core": "^1.0.0-beta.15",
30
+ "@types/bun": "latest",
31
+ "ai": "^4",
32
+ "typescript": "^5.0.0",
33
+ "zod": "^4"
34
+ },
35
+ "keywords": [
36
+ "mastra",
37
+ "agent",
38
+ "minds",
39
+ "skills",
40
+ "claude",
41
+ "ai",
42
+ "llm"
43
+ ],
44
+ "license": "MIT"
45
+ }