studiograph 1.1.1 → 1.1.3
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 +191 -0
- package/README.md +307 -10
- package/dist/agent/orchestrator.d.ts +17 -9
- package/dist/agent/orchestrator.js +95 -95
- package/dist/agent/orchestrator.js.map +1 -1
- package/dist/agent/prompts/system.md +168 -0
- package/dist/agent/skills/bundled/enrich-entities.md +124 -0
- package/dist/agent/skills/bundled/gather-context.md +46 -0
- package/dist/agent/skills/skill-loader.d.ts +48 -0
- package/dist/agent/skills/skill-loader.js +166 -0
- package/dist/agent/skills/skill-loader.js.map +1 -0
- package/dist/agent/tools/graph-tools.d.ts +20 -2
- package/dist/agent/tools/graph-tools.js +64 -8
- package/dist/agent/tools/graph-tools.js.map +1 -1
- package/dist/agent/tools/load-skill.d.ts +42 -0
- package/dist/agent/tools/load-skill.js +45 -0
- package/dist/agent/tools/load-skill.js.map +1 -0
- package/dist/agent/tools/tool-loader.d.ts +25 -0
- package/dist/agent/tools/tool-loader.js +73 -0
- package/dist/agent/tools/tool-loader.js.map +1 -0
- package/dist/cli/commands/app.d.ts +7 -0
- package/dist/cli/commands/app.js +167 -0
- package/dist/cli/commands/app.js.map +1 -0
- package/dist/cli/commands/config.d.ts +13 -0
- package/dist/cli/commands/config.js +276 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/connector.d.ts +33 -0
- package/dist/cli/commands/connector.js +170 -0
- package/dist/cli/commands/connector.js.map +1 -0
- package/dist/cli/commands/deploy.d.ts +11 -0
- package/dist/cli/commands/deploy.js +153 -0
- package/dist/cli/commands/deploy.js.map +1 -0
- package/dist/cli/commands/index.d.ts +15 -0
- package/dist/cli/commands/index.js +117 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init.js +110 -28
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/join.js +67 -22
- package/dist/cli/commands/join.js.map +1 -1
- package/dist/cli/commands/lint.d.ts +8 -0
- package/dist/cli/commands/lint.js +70 -0
- package/dist/cli/commands/lint.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +27 -0
- package/dist/cli/commands/mcp.js +56 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/provision.d.ts +8 -0
- package/dist/cli/commands/provision.js +112 -0
- package/dist/cli/commands/provision.js.map +1 -0
- package/dist/cli/commands/r2.d.ts +2 -0
- package/dist/cli/commands/r2.js +186 -4
- package/dist/cli/commands/r2.js.map +1 -1
- package/dist/cli/commands/serve.js +47 -2
- package/dist/cli/commands/serve.js.map +1 -1
- package/dist/cli/commands/start.js +210 -71
- package/dist/cli/commands/start.js.map +1 -1
- package/dist/cli/commands/sync.js +4 -4
- package/dist/cli/commands/sync.js.map +1 -1
- package/dist/cli/commands/update.d.ts +8 -0
- package/dist/cli/commands/update.js +155 -0
- package/dist/cli/commands/update.js.map +1 -0
- package/dist/cli/index.js +83 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/scaffolding.d.ts +9 -0
- package/dist/cli/scaffolding.js +288 -0
- package/dist/cli/scaffolding.js.map +1 -0
- package/dist/core/graph.d.ts +12 -1
- package/dist/core/graph.js +147 -78
- package/dist/core/graph.js.map +1 -1
- package/dist/core/migration-runner.d.ts +39 -0
- package/dist/core/migration-runner.js +221 -0
- package/dist/core/migration-runner.js.map +1 -0
- package/dist/core/migration-types.d.ts +101 -0
- package/dist/core/migration-types.js +21 -0
- package/dist/core/migration-types.js.map +1 -0
- package/dist/core/migrations/20260219-formalize-memory-location.d.ts +2 -0
- package/dist/core/migrations/20260219-formalize-memory-location.js +35 -0
- package/dist/core/migrations/20260219-formalize-memory-location.js.map +1 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.d.ts +12 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.js +65 -0
- package/dist/core/migrations/20260220-add-workspace-metadata.js.map +1 -0
- package/dist/core/migrations/20260220-add-workspace-readme.d.ts +11 -0
- package/dist/core/migrations/20260220-add-workspace-readme.js +82 -0
- package/dist/core/migrations/20260220-add-workspace-readme.js.map +1 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.d.ts +9 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.js +64 -0
- package/dist/core/migrations/20260220-migrate-yaml-to-json.js.map +1 -0
- package/dist/core/migrations/index.d.ts +11 -0
- package/dist/core/migrations/index.js +23 -0
- package/dist/core/migrations/index.js.map +1 -0
- package/dist/core/schema-registry.d.ts +36 -0
- package/dist/core/schema-registry.js +161 -0
- package/dist/core/schema-registry.js.map +1 -0
- package/dist/core/types.d.ts +242 -0
- package/dist/core/types.js +21 -0
- package/dist/core/types.js.map +1 -1
- package/dist/core/user-config.d.ts +10 -0
- package/dist/core/user-config.js +8 -0
- package/dist/core/user-config.js.map +1 -1
- package/dist/core/validation.d.ts +973 -32
- package/dist/core/validation.js +163 -4
- package/dist/core/validation.js.map +1 -1
- package/dist/core/workspace-manager.d.ts +26 -2
- package/dist/core/workspace-manager.js +113 -15
- package/dist/core/workspace-manager.js.map +1 -1
- package/dist/core/workspace.d.ts +8 -7
- package/dist/core/workspace.js +25 -13
- package/dist/core/workspace.js.map +1 -1
- package/dist/mcp/connector-manager.d.ts +61 -0
- package/dist/mcp/connector-manager.js +178 -0
- package/dist/mcp/connector-manager.js.map +1 -0
- package/dist/mcp/connectors/definitions.d.ts +43 -0
- package/dist/mcp/connectors/definitions.js +140 -0
- package/dist/mcp/connectors/definitions.js.map +1 -0
- package/dist/mcp/server.d.ts +11 -0
- package/dist/mcp/server.js +28 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +14 -0
- package/dist/mcp/tools.js +172 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/server/index.js +17 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/plugin-loader.d.ts +8 -0
- package/dist/server/plugin-loader.js +14 -0
- package/dist/server/plugin-loader.js.map +1 -1
- package/dist/server/routes/graph-api.js +1 -1
- package/dist/server/routes/graph-api.js.map +1 -1
- package/dist/server/routes/webhook.js +33 -0
- package/dist/server/routes/webhook.js.map +1 -1
- package/dist/services/github-provisioner.d.ts +1 -0
- package/dist/services/github-provisioner.js +11 -0
- package/dist/services/github-provisioner.js.map +1 -1
- package/dist/services/lint-service.d.ts +27 -0
- package/dist/services/lint-service.js +76 -0
- package/dist/services/lint-service.js.map +1 -0
- package/dist/services/markdown.d.ts +9 -0
- package/dist/services/markdown.js +23 -2
- package/dist/services/markdown.js.map +1 -1
- package/dist/services/memory-service.d.ts +1 -2
- package/dist/services/memory-service.js +6 -4
- package/dist/services/memory-service.js.map +1 -1
- package/dist/services/vector-service.d.ts +77 -0
- package/dist/services/vector-service.js +280 -0
- package/dist/services/vector-service.js.map +1 -0
- package/dist/utils/version-checker.d.ts +23 -0
- package/dist/utils/version-checker.js +116 -0
- package/dist/utils/version-checker.js.map +1 -0
- package/package.json +10 -6
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
* Manages the Pi-Mono agent instance and coordinates with workspace managers.
|
|
5
5
|
* Loads skills, handles system prompts, and manages conversation flow.
|
|
6
6
|
*/
|
|
7
|
-
import { readFileSync, existsSync
|
|
7
|
+
import { readFileSync, existsSync } from 'fs';
|
|
8
8
|
import { join, dirname } from 'path';
|
|
9
|
+
import { homedir } from 'os';
|
|
9
10
|
import { fileURLToPath } from 'url';
|
|
10
11
|
const __filename = fileURLToPath(import.meta.url);
|
|
11
12
|
const __dirname = dirname(__filename);
|
|
@@ -13,63 +14,117 @@ import { getModel } from '@mariozechner/pi-ai';
|
|
|
13
14
|
import { Agent } from '@mariozechner/pi-agent-core';
|
|
14
15
|
import { WorkspaceManager } from '../core/workspace-manager.js';
|
|
15
16
|
import { createGraphTools } from './tools/graph-tools.js';
|
|
17
|
+
import { loadSkillIndex, buildSkillIndexPrompt, loadEagerSkills } from './skills/skill-loader.js';
|
|
18
|
+
import { createLoadSkillTool } from './tools/load-skill.js';
|
|
19
|
+
import { loadCustomTools } from './tools/tool-loader.js';
|
|
20
|
+
import { ConnectorManager } from '../mcp/connector-manager.js';
|
|
21
|
+
import { loadUserConfig, getAnthropicCredential } from '../core/user-config.js';
|
|
16
22
|
export class AgentOrchestrator {
|
|
17
23
|
workspacePath;
|
|
18
24
|
workspaceManager;
|
|
19
25
|
agent;
|
|
20
26
|
config;
|
|
21
27
|
gitUser;
|
|
22
|
-
|
|
28
|
+
skillsDirs;
|
|
29
|
+
toolsDirs;
|
|
23
30
|
constructor(config) {
|
|
24
31
|
this.workspacePath = config.workspacePath;
|
|
25
32
|
this.config = config.workspaceConfig;
|
|
26
33
|
this.gitUser = config.gitUser;
|
|
27
|
-
|
|
34
|
+
// Priority (highest → lowest): user > workspace > bundled > app
|
|
35
|
+
// First-seen name wins in the loader, so earlier dirs override later ones.
|
|
36
|
+
const userSkillsDir = join(homedir(), '.studiograph', 'skills');
|
|
37
|
+
const userToolsDir = join(homedir(), '.studiograph', 'tools');
|
|
38
|
+
const workspaceSkillsDir = join(this.workspacePath, '.studiograph', 'skills');
|
|
39
|
+
const workspaceToolsDir = join(this.workspacePath, '.studiograph', 'tools');
|
|
40
|
+
const bundledSkillsDir = join(__dirname, 'skills', 'bundled');
|
|
41
|
+
this.skillsDirs = [userSkillsDir, workspaceSkillsDir, bundledSkillsDir, ...(config.skillsDirs ?? [])];
|
|
42
|
+
this.toolsDirs = [userToolsDir, workspaceToolsDir, ...(config.toolsDirs ?? [])];
|
|
28
43
|
// Initialize workspace manager
|
|
29
44
|
const orchestratorUser = { ...this.gitUser, role: 'admin' };
|
|
30
45
|
this.workspaceManager = new WorkspaceManager(this.workspacePath, this.config, this.gitUser, orchestratorUser);
|
|
31
|
-
// Initialize Pi-Mono agent
|
|
46
|
+
// Initialize Pi-Mono agent (async tools loaded in createAgent)
|
|
32
47
|
this.agent = this.createAgent();
|
|
33
48
|
}
|
|
34
49
|
/**
|
|
35
|
-
* Create Pi-Mono agent with tools and system prompt
|
|
50
|
+
* Create Pi-Mono agent with tools and system prompt.
|
|
51
|
+
* Custom tools and skills are loaded asynchronously via initAsync().
|
|
36
52
|
*/
|
|
37
53
|
createAgent() {
|
|
38
|
-
// Get model from config
|
|
39
54
|
const provider = this.config.model_provider || 'anthropic';
|
|
40
55
|
const modelId = this.config.model_id || 'claude-sonnet-4-5-20250929';
|
|
41
|
-
const
|
|
56
|
+
const userConfig = loadUserConfig();
|
|
57
|
+
const apiKey = getAnthropicCredential(userConfig) || this.config.api_key || process.env.ANTHROPIC_API_KEY || '';
|
|
42
58
|
if (!apiKey) {
|
|
43
59
|
throw new Error('API key not found in config or environment');
|
|
44
60
|
}
|
|
45
61
|
const model = getModel(provider, modelId);
|
|
46
|
-
//
|
|
47
|
-
const
|
|
48
|
-
//
|
|
49
|
-
const
|
|
50
|
-
//
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
62
|
+
// Build skill index (synchronous — reads markdown frontmatter only)
|
|
63
|
+
const skillIndex = loadSkillIndex(this.skillsDirs);
|
|
64
|
+
// Build system prompt — base + eager skills + skill index
|
|
65
|
+
const systemPrompt = this.buildSystemPrompt(skillIndex);
|
|
66
|
+
// Built-in graph tools + load_skill tool
|
|
67
|
+
const tools = [
|
|
68
|
+
...createGraphTools(this.workspaceManager, this.gitUser),
|
|
69
|
+
createLoadSkillTool(skillIndex),
|
|
70
|
+
];
|
|
71
|
+
const agent = new Agent({ getApiKey: () => apiKey });
|
|
55
72
|
agent.setModel(model);
|
|
56
73
|
agent.setSystemPrompt(systemPrompt);
|
|
57
74
|
agent.setTools(tools);
|
|
75
|
+
// Load custom tools asynchronously and register them
|
|
76
|
+
this.loadCustomToolsAsync(agent);
|
|
58
77
|
return agent;
|
|
59
78
|
}
|
|
60
79
|
/**
|
|
61
|
-
* Load
|
|
80
|
+
* Load custom JS tools from app/workspace tool dirs and append to the agent.
|
|
81
|
+
* Runs async after construction — custom tools may not be available for the
|
|
82
|
+
* very first message if initialisation is extremely fast, but in practice
|
|
83
|
+
* the first user message arrives well after startup.
|
|
62
84
|
*/
|
|
63
|
-
|
|
85
|
+
loadCustomToolsAsync(agent) {
|
|
86
|
+
const context = { workspaceManager: this.workspaceManager, gitUser: this.gitUser };
|
|
87
|
+
Promise.all([
|
|
88
|
+
loadCustomTools(this.toolsDirs, context),
|
|
89
|
+
ConnectorManager.buildTools(ConnectorManager.loadConfigs()),
|
|
90
|
+
]).then(([customTools, connectorTools]) => {
|
|
91
|
+
const extra = [...customTools, ...connectorTools];
|
|
92
|
+
if (extra.length > 0) {
|
|
93
|
+
const existing = agent.state.tools;
|
|
94
|
+
agent.setTools([...existing, ...extra]);
|
|
95
|
+
}
|
|
96
|
+
}).catch(err => {
|
|
97
|
+
console.warn('Failed to load custom/connector tools:', err);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Build the full system prompt: base prompt + eager skill content + skill index.
|
|
102
|
+
*/
|
|
103
|
+
buildSystemPrompt(skillIndex) {
|
|
64
104
|
const promptPath = join(__dirname, 'prompts', 'system.md');
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
105
|
+
const base = existsSync(promptPath)
|
|
106
|
+
? readFileSync(promptPath, 'utf-8')
|
|
107
|
+
: this.getDefaultSystemPrompt();
|
|
108
|
+
const parts = [base.trim()];
|
|
109
|
+
// Append workspace schema extensions (org-specific fields and custom types)
|
|
110
|
+
const schemaSection = this.workspaceManager.getSchemaRegistry().toPromptSection();
|
|
111
|
+
if (schemaSection) {
|
|
112
|
+
parts.push(schemaSection);
|
|
113
|
+
}
|
|
114
|
+
// Inline eager skills directly into the system prompt
|
|
115
|
+
const eagerContent = loadEagerSkills(skillIndex);
|
|
116
|
+
if (eagerContent) {
|
|
117
|
+
parts.push(eagerContent);
|
|
68
118
|
}
|
|
69
|
-
|
|
119
|
+
// Append skill index for on-demand skills
|
|
120
|
+
const index = buildSkillIndexPrompt(skillIndex);
|
|
121
|
+
if (index) {
|
|
122
|
+
parts.push(index);
|
|
123
|
+
}
|
|
124
|
+
return parts.join('\n\n');
|
|
70
125
|
}
|
|
71
126
|
/**
|
|
72
|
-
*
|
|
127
|
+
* Fallback system prompt when prompts/system.md is not found.
|
|
73
128
|
*/
|
|
74
129
|
getDefaultSystemPrompt() {
|
|
75
130
|
const workspaceSummary = this.workspaceManager.getSummary();
|
|
@@ -81,73 +136,14 @@ export class AgentOrchestrator {
|
|
|
81
136
|
|
|
82
137
|
You are Studiograph, an AI assistant helping creative teams manage their knowledge graphs.
|
|
83
138
|
|
|
84
|
-
## Workspace
|
|
139
|
+
## Workspace
|
|
85
140
|
|
|
86
141
|
**Team:** ${this.config.team_name}
|
|
87
142
|
**Repositories:** ${workspaceSummary.totalRepos}
|
|
88
143
|
**Total Entities:** ${workspaceSummary.totalEntities}
|
|
89
144
|
|
|
90
145
|
**Available Repositories:**
|
|
91
|
-
${repoList}
|
|
92
|
-
|
|
93
|
-
## Your Capabilities
|
|
94
|
-
|
|
95
|
-
You can help with:
|
|
96
|
-
- Creating and managing entities (projects, clients, decisions, references, etc.)
|
|
97
|
-
- Searching across repositories
|
|
98
|
-
- Validating wikilinks and relationships
|
|
99
|
-
- Uploading and managing assets
|
|
100
|
-
- Generating insights from the knowledge graph
|
|
101
|
-
|
|
102
|
-
## Guidelines
|
|
103
|
-
|
|
104
|
-
- Always ask clarifying questions before creating entities
|
|
105
|
-
- Validate wikilinks to ensure data integrity
|
|
106
|
-
- Suggest related entities based on context
|
|
107
|
-
- Be proactive in maintaining the knowledge graph
|
|
108
|
-
- Use the tools available to you effectively
|
|
109
|
-
|
|
110
|
-
## Available Tools
|
|
111
|
-
|
|
112
|
-
You have access to graph management tools that allow you to:
|
|
113
|
-
- Create, read, update, and delete entities
|
|
114
|
-
- Search and filter entities
|
|
115
|
-
- Manage wikilinks and relationships
|
|
116
|
-
- Upload and manage assets
|
|
117
|
-
|
|
118
|
-
Use these tools to help users build and navigate their knowledge graph.
|
|
119
|
-
`;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Load tools from skills directory
|
|
123
|
-
*/
|
|
124
|
-
loadTools() {
|
|
125
|
-
const tools = [];
|
|
126
|
-
// Load built-in graph tools
|
|
127
|
-
const graphTools = createGraphTools(this.workspaceManager, this.gitUser);
|
|
128
|
-
tools.push(...graphTools);
|
|
129
|
-
// Load custom skills from skills directory
|
|
130
|
-
if (existsSync(this.skillsPath)) {
|
|
131
|
-
try {
|
|
132
|
-
const skillFiles = readdirSync(this.skillsPath).filter(f => f.endsWith('.js'));
|
|
133
|
-
for (const skillFile of skillFiles) {
|
|
134
|
-
try {
|
|
135
|
-
const skillPath = join(this.skillsPath, skillFile);
|
|
136
|
-
const skill = require(skillPath);
|
|
137
|
-
if (skill.default && typeof skill.default === 'object') {
|
|
138
|
-
tools.push(skill.default);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
142
|
-
console.warn(`Failed to load skill ${skillFile}:`, error);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
console.warn('Failed to load skills:', error);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return tools;
|
|
146
|
+
${repoList}`;
|
|
151
147
|
}
|
|
152
148
|
/**
|
|
153
149
|
* Send a message to the agent
|
|
@@ -156,28 +152,32 @@ Use these tools to help users build and navigate their knowledge graph.
|
|
|
156
152
|
return new Promise((resolve, reject) => {
|
|
157
153
|
let content = '';
|
|
158
154
|
const toolCalls = [];
|
|
159
|
-
// Subscribe to agent events
|
|
155
|
+
// Subscribe to agent events.
|
|
156
|
+
// message_update: { type, message: PartialMessage } — accumulate text from assistant turns
|
|
157
|
+
// message_end: { type, message: AgentMessage } — also fires for user prompt messages, so filter by role
|
|
158
|
+
// agent_end: fires once when the full agentic loop is done — resolve here
|
|
160
159
|
const unsubscribe = this.agent.subscribe((event) => {
|
|
161
|
-
if (event.type === '
|
|
162
|
-
const msgEvent = event.assistantMessageEvent;
|
|
163
|
-
if (msgEvent.type === 'text_delta') {
|
|
164
|
-
content += msgEvent.delta;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
else if (event.type === 'message_end') {
|
|
168
|
-
// Extract tool calls from message content
|
|
160
|
+
if (event.type === 'message_end') {
|
|
169
161
|
const msg = event.message;
|
|
170
|
-
if (msg
|
|
162
|
+
if (msg?.role === 'assistant') {
|
|
163
|
+
// Collect text and tool calls from completed assistant message
|
|
164
|
+
content = msg.content
|
|
165
|
+
.filter((b) => b.type === 'text')
|
|
166
|
+
.map((b) => b.text)
|
|
167
|
+
.join('');
|
|
171
168
|
for (const block of msg.content) {
|
|
172
169
|
if (block.type === 'toolCall') {
|
|
173
170
|
toolCalls.push({
|
|
174
171
|
tool: block.name,
|
|
175
172
|
input: block.input,
|
|
176
|
-
output: null,
|
|
173
|
+
output: null,
|
|
177
174
|
});
|
|
178
175
|
}
|
|
179
176
|
}
|
|
180
177
|
}
|
|
178
|
+
}
|
|
179
|
+
else if (event.type === 'agent_end') {
|
|
180
|
+
// Full agentic loop complete (all turns + tool calls done)
|
|
181
181
|
unsubscribe();
|
|
182
182
|
resolve({ content, toolCalls });
|
|
183
183
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/agent/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/agent/orchestrator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,UAAU,EAAe,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAE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,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;6BACvB,IAAI,CAAC,EAAE,CAAC,CAAC;wBACZ,KAAK,MAAM,KAAK,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;4BAChC,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;gCAC9B,SAAS,CAAC,IAAI,CAAC;oCACb,IAAI,EAAE,KAAK,CAAC,IAAI;oCAChB,KAAK,EAAE,KAAK,CAAC,KAAK;oCAClB,MAAM,EAAE,IAAI;iCACb,CAAC,CAAC;4BACL,CAAC;wBACH,CAAC;oBACH,CAAC;gBACH,CAAC;qBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;oBACtC,2DAA2D;oBAC3D,WAAW,EAAE,CAAC;oBACd,OAAO,CAAC,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;gBAClC,CAAC;YACH,CAAC,CAAC,CAAC;YAEH,iCAAiC;YACjC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC7C,WAAW,EAAE,CAAC;gBACd,MAAM,CAAC,KAAK,CAAC,CAAC;YAChB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,UAAU;QACR,OAAO,IAAI,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,CAAC;IAC9C,CAAC;CACF"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Studiograph AI Assistant
|
|
2
|
+
|
|
3
|
+
You are Studiograph, an AI assistant helping creative teams manage their knowledge graphs. Your role is to help teams organize projects, clients, decisions, references, and other entities in a structured, interconnected way using Git-backed markdown files.
|
|
4
|
+
|
|
5
|
+
## Core Capabilities
|
|
6
|
+
|
|
7
|
+
You can help users with:
|
|
8
|
+
|
|
9
|
+
1. **Entity Management**
|
|
10
|
+
- Create, read, update, and delete entities (projects, clients, decisions, briefs, etc.)
|
|
11
|
+
- Validate entity data against schemas
|
|
12
|
+
- Suggest appropriate entity types for user needs
|
|
13
|
+
|
|
14
|
+
2. **Knowledge Graph Navigation**
|
|
15
|
+
- Search across repositories
|
|
16
|
+
- Follow wikilink relationships
|
|
17
|
+
- Find related entities and backlinks
|
|
18
|
+
- Validate wikilinks to ensure data integrity
|
|
19
|
+
|
|
20
|
+
3. **Asset Management**
|
|
21
|
+
- Upload and manage media files (images, videos, documents)
|
|
22
|
+
- Organize assets by entity
|
|
23
|
+
- Track asset metadata
|
|
24
|
+
|
|
25
|
+
4. **Insights and Organization**
|
|
26
|
+
- Suggest connections between entities
|
|
27
|
+
- Identify missing relationships
|
|
28
|
+
- Recommend entity creation based on context
|
|
29
|
+
|
|
30
|
+
## Guidelines
|
|
31
|
+
|
|
32
|
+
**Be Conversational:**
|
|
33
|
+
- Ask clarifying questions before taking action
|
|
34
|
+
- Explain what you're doing and why
|
|
35
|
+
- Suggest next steps proactively
|
|
36
|
+
|
|
37
|
+
**Maintain Data Integrity:**
|
|
38
|
+
- Always validate wikilinks before creating them
|
|
39
|
+
- Ensure required fields are present
|
|
40
|
+
- Check for duplicate entities
|
|
41
|
+
- Use appropriate entity types
|
|
42
|
+
|
|
43
|
+
**Be Helpful:**
|
|
44
|
+
- Suggest related entities based on context
|
|
45
|
+
- Offer to create missing referenced entities
|
|
46
|
+
- Recommend useful searches or queries
|
|
47
|
+
- Help users discover patterns in their knowledge graph
|
|
48
|
+
|
|
49
|
+
**Respect Structure:**
|
|
50
|
+
- Follow the established entity schemas
|
|
51
|
+
- Maintain consistent naming conventions (kebab-case IDs)
|
|
52
|
+
- Preserve YAML frontmatter formatting
|
|
53
|
+
- Keep wikilinks properly formatted: `[[entity-id]]` or `[[entity-id|Display Text]]`
|
|
54
|
+
|
|
55
|
+
## Entity Types
|
|
56
|
+
|
|
57
|
+
You have access to the following entity types:
|
|
58
|
+
|
|
59
|
+
**Project Repos:**
|
|
60
|
+
- `project`: Client engagements with timelines and deliverables
|
|
61
|
+
- `meeting`: Dated events with attendees, notes, decisions
|
|
62
|
+
- `decision`: Structured decision records (DEC-YYYY-NNN format)
|
|
63
|
+
- `task`: Lightweight action items and to-dos (assignee, due_date, status: open/in-progress/done/cancelled, priority, related to projects/meetings/deliverables)
|
|
64
|
+
- `brief`: Project requirements and specifications
|
|
65
|
+
- `deliverable`: Scoped contractual output promised to a client (e.g. "Brand Identity System"); contains multiple artifacts
|
|
66
|
+
- `artifact`: Individual generated outputs (decks, docs, prototypes) produced within a deliverable
|
|
67
|
+
|
|
68
|
+
**Function Repos:**
|
|
69
|
+
- `deal`: Pre-project sales opportunity moving through the pipeline (scoping → proposal → negotiating → won/lost)
|
|
70
|
+
- `proposal`: Client proposals with pricing
|
|
71
|
+
- `contract`: SOWs, MSAs, NDAs
|
|
72
|
+
- `client`: Organizations — use `status: prospect` for leads not yet engaged
|
|
73
|
+
- `person`: Individual contacts (external clients, partners, team members) with optional `reports_to` and `department`
|
|
74
|
+
- `financial-plan`: Budgets, rates, forecasts
|
|
75
|
+
- `vendor`: External suppliers, freelancers, and partners (type: freelancer/agency/supplier/platform/partner)
|
|
76
|
+
- `role`: Generalized role definitions from the firm's leveling framework (title, department, level, responsibilities + leveling criteria)
|
|
77
|
+
|
|
78
|
+
**Shared Resource Repos:**
|
|
79
|
+
- `template`: Document templates
|
|
80
|
+
- `process`: Standardized workflows
|
|
81
|
+
- `standard`: Guidelines and best practices
|
|
82
|
+
- `reference`: External examples (projects, articles, tools)
|
|
83
|
+
- `technique`: Design patterns and methods
|
|
84
|
+
- `practice-area`: Firm capabilities and disciplines (e.g. Data Visualization, UX Design)
|
|
85
|
+
- `case-study`: Portfolio narratives for completed projects (objective, solution, outcome, team, press, awards)
|
|
86
|
+
|
|
87
|
+
**App Types:**
|
|
88
|
+
- `dataset`: Tabular data with a declared column schema (name, type, required). Body is raw CSV. Use for time tracking, budgets, rosters, inventories.
|
|
89
|
+
- `deck`: Presentation deck entity (rendered by the Schema Slides app)
|
|
90
|
+
|
|
91
|
+
**Deal lifecycle:** `client` (status: prospect) + `person` contacts → `deal` → `proposal` documents → won → `project` → `deliverable` → `artifact[]`
|
|
92
|
+
|
|
93
|
+
## Artifact Placement
|
|
94
|
+
|
|
95
|
+
When you create or file an artifact, follow these rules:
|
|
96
|
+
|
|
97
|
+
**Confirm before writing:**
|
|
98
|
+
Unless the user has explicitly specified where to put an artifact, always confirm the inferred location before creating it. For example: *"I'll save this as an artifact in the `new-business/` repo under the RAA deal — does that sound right?"* Wait for confirmation before calling `create_entity`.
|
|
99
|
+
|
|
100
|
+
**Repo selection:**
|
|
101
|
+
- Related to a deal or proposal → the function repo containing that deal (e.g. `new-business/`)
|
|
102
|
+
- Related to a specific project → that project's repo
|
|
103
|
+
- Team-wide reusable output → shared resource repo
|
|
104
|
+
|
|
105
|
+
**Privacy — `private/` vs. visibility field:**
|
|
106
|
+
|
|
107
|
+
These are two different mechanisms. Do not confuse them:
|
|
108
|
+
|
|
109
|
+
| | `repo: "private"` | `visibility: admin/restricted` |
|
|
110
|
+
|---|---|---|
|
|
111
|
+
| What it means | File stays on this machine only, never committed | File is committed but access-controlled in the repo |
|
|
112
|
+
| Use when | "Make it private" / draft / sensitive / not ready to share | Committed file that only certain roles should see |
|
|
113
|
+
|
|
114
|
+
When a user says "make it private", "keep this to myself", "don't share this", or "just for me" → use `repo: "private"`. Do **not** use `visibility: admin` or `visibility: restricted` as a substitute for local-only storage.
|
|
115
|
+
|
|
116
|
+
- If a draft or sensitive artifact should stay local → `repo: "private"`, `entityType: "artifact"`
|
|
117
|
+
- When unsure, ask: *"Should this stay private on your machine, or be committed to the team repo with restricted access?"*
|
|
118
|
+
- Private entities can wikilink to public entities
|
|
119
|
+
- Files in `private/` do not appear in workspace-wide `list_entities` — use `search_entities` with `repoNames: ["private"]` to retrieve them
|
|
120
|
+
- Never suggest committing or pushing anything from `private/`
|
|
121
|
+
|
|
122
|
+
**Entity type for generated content:**
|
|
123
|
+
- Reports, assessments, summaries, email drafts, briefs, analyses → use `artifact` (type field: `"report"`, `"brief"`, etc.)
|
|
124
|
+
- Do not probe for unknown entity types (assessment, report, note, document, etc.) — they don't exist. `artifact` is the correct type for any generated document.
|
|
125
|
+
|
|
126
|
+
**Content format:**
|
|
127
|
+
- Text artifacts (email drafts, briefs, summaries) → content in the markdown body of the artifact entity
|
|
128
|
+
- Binary or externally-hosted files → `url` field pointing to R2 URL or local path
|
|
129
|
+
|
|
130
|
+
## Interaction Patterns
|
|
131
|
+
|
|
132
|
+
**When creating entities:**
|
|
133
|
+
1. Ask for required information
|
|
134
|
+
2. Validate data
|
|
135
|
+
3. Confirm before creating
|
|
136
|
+
4. Suggest related entities to link
|
|
137
|
+
|
|
138
|
+
**When searching:**
|
|
139
|
+
1. Understand user intent
|
|
140
|
+
2. Use appropriate filters
|
|
141
|
+
3. Present results clearly
|
|
142
|
+
4. Offer to narrow or broaden search
|
|
143
|
+
|
|
144
|
+
**When navigating relationships:**
|
|
145
|
+
1. Show related entities
|
|
146
|
+
2. Explain connections
|
|
147
|
+
3. Suggest additional relationships
|
|
148
|
+
4. Help users discover patterns
|
|
149
|
+
|
|
150
|
+
## Tools
|
|
151
|
+
|
|
152
|
+
You have access to graph management tools that allow you to:
|
|
153
|
+
- Create, read, update, delete entities
|
|
154
|
+
- Search and filter entities across repos
|
|
155
|
+
- Manage wikilinks and relationships
|
|
156
|
+
- Upload and manage assets
|
|
157
|
+
- Get workspace statistics
|
|
158
|
+
- Query dataset rows with filters (`query_dataset`) and append new rows (`append_rows`)
|
|
159
|
+
|
|
160
|
+
Use these tools to help users build and navigate their knowledge graph effectively.
|
|
161
|
+
|
|
162
|
+
## Remember
|
|
163
|
+
|
|
164
|
+
- You're here to help teams work better, not just to manage data
|
|
165
|
+
- Every entity represents real work and decisions
|
|
166
|
+
- Wikilinks create the knowledge graph - they're crucial
|
|
167
|
+
- Git provides version history - changes are never lost
|
|
168
|
+
- Be proactive but always confirm before making changes
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: enrich-entities
|
|
3
|
+
description: Proactively suggest enrichment for incomplete entities using context
|
|
4
|
+
loading: eager
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Entity Enrichment
|
|
8
|
+
|
|
9
|
+
When you discover incomplete entities (missing recommended fields), proactively suggest enrichment using contextual inference.
|
|
10
|
+
|
|
11
|
+
## When to Enrich
|
|
12
|
+
|
|
13
|
+
**Proactive discovery:**
|
|
14
|
+
- User asks to "clean up" or "enrich" entities
|
|
15
|
+
- You call `lint_entities` and find incomplete records
|
|
16
|
+
- You fetch an entity and notice missing recommended fields
|
|
17
|
+
|
|
18
|
+
**During normal work:**
|
|
19
|
+
- User asks about a specific entity and you notice gaps
|
|
20
|
+
- You're creating related entities and spot incomplete references
|
|
21
|
+
|
|
22
|
+
## How to Enrich
|
|
23
|
+
|
|
24
|
+
### 1. Discover gaps
|
|
25
|
+
Use `lint_entities` to find incomplete entities:
|
|
26
|
+
```
|
|
27
|
+
lint_entities({ entityType: "project" })
|
|
28
|
+
→ 12 projects missing client, start_date, or end_date
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Gather context for each incomplete entity
|
|
32
|
+
- **Fetch the entity:** `get_entity({ entityId: "..." })`
|
|
33
|
+
- **Find related entities:** `get_backlinks({ entityId: "..." })`
|
|
34
|
+
- **Search for references:** Look in meeting notes, proposals, briefs
|
|
35
|
+
- **Check memory:** Review past conversations about this entity
|
|
36
|
+
|
|
37
|
+
### 3. Infer missing values from context
|
|
38
|
+
|
|
39
|
+
**Missing client:**
|
|
40
|
+
- Search entity markdown body for `[[client-name]]` wikilinks
|
|
41
|
+
- Check backlinks from meetings, proposals, deals
|
|
42
|
+
- Look for client mentions in related artifacts
|
|
43
|
+
|
|
44
|
+
**Missing dates:**
|
|
45
|
+
- Extract from related meetings (kickoff = start_date)
|
|
46
|
+
- Check proposal expected_start or contract signed_date
|
|
47
|
+
- Look for date mentions in project description
|
|
48
|
+
|
|
49
|
+
**Missing relationships:**
|
|
50
|
+
- Scan for wikilinks in markdown body
|
|
51
|
+
- Check what entities reference this one (backlinks)
|
|
52
|
+
- Infer from entity type (artifact → deliverable → project)
|
|
53
|
+
|
|
54
|
+
### 4. Suggest, don't assume
|
|
55
|
+
Always confirm before updating:
|
|
56
|
+
|
|
57
|
+
> "I notice this project is missing a client. I see Meridian Health mentioned in 3 related meetings and the project brief. Should I add `client: [[meridian-rebrand]]`?"
|
|
58
|
+
|
|
59
|
+
Wait for user confirmation, then call `update_entity`.
|
|
60
|
+
|
|
61
|
+
## Example Workflows
|
|
62
|
+
|
|
63
|
+
**Batch enrichment:**
|
|
64
|
+
```
|
|
65
|
+
User: "Help me fill in missing clients for incomplete projects"
|
|
66
|
+
|
|
67
|
+
You:
|
|
68
|
+
1. lint_entities({ entityType: "project" }) → 8 missing client
|
|
69
|
+
2. For each project:
|
|
70
|
+
- get_entity() → read markdown body
|
|
71
|
+
- get_backlinks() → find meetings, proposals
|
|
72
|
+
- Search for client wikilinks
|
|
73
|
+
- Suggest: "Add client: [[acme]]?" → confirm → update
|
|
74
|
+
3. Report: "Enriched 6/8 projects. 2 need manual review (no clear client in context)."
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Focused enrichment:**
|
|
78
|
+
```
|
|
79
|
+
User: "Fill in missing deal values"
|
|
80
|
+
|
|
81
|
+
You:
|
|
82
|
+
1. lint_entities({ entityType: "deal" }) → 5 deals missing deal_value
|
|
83
|
+
2. For each deal:
|
|
84
|
+
- get_backlinks() → find related proposal
|
|
85
|
+
- get_entity() on proposal → extract fees
|
|
86
|
+
- Suggest: "This deal's proposal shows $50k. Add deal_value: 50000?" → confirm → update
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
**Inline during work:**
|
|
90
|
+
```
|
|
91
|
+
User: "Show me the Acme project"
|
|
92
|
+
|
|
93
|
+
You:
|
|
94
|
+
1. get_entity({ entityId: "acme-rebrand" })
|
|
95
|
+
2. Notice missing: client, start_date
|
|
96
|
+
3. Get context: search for Acme client entity, check proposal
|
|
97
|
+
4. Suggest inline: "This project is missing a client and start date. I found the Acme client entity and a proposal dated 2026-01-15. Should I add those?"
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Guidelines
|
|
101
|
+
|
|
102
|
+
**Do:**
|
|
103
|
+
- Use multiple context sources (backlinks, search, memory, markdown body)
|
|
104
|
+
- Present evidence: "I see X mentioned in 3 meetings"
|
|
105
|
+
- Batch similar fields: "Should I add client and start_date?"
|
|
106
|
+
- Report progress: "Enriched 8/12, 4 need review"
|
|
107
|
+
|
|
108
|
+
**Don't:**
|
|
109
|
+
- Update without confirmation
|
|
110
|
+
- Guess when evidence is weak ("I'm not sure which client this is")
|
|
111
|
+
- Over-enrich — only fill recommended fields that are clearly missing
|
|
112
|
+
- Make up data — if no context exists, say so: "I couldn't find a clear client reference. Would you like to specify it?"
|
|
113
|
+
|
|
114
|
+
## Priority Fields
|
|
115
|
+
|
|
116
|
+
Focus enrichment on high-value semantic fields:
|
|
117
|
+
1. **Relationships** — client, project, deliverable (wikilinks)
|
|
118
|
+
2. **Dates** — start_date, due_date, expected_close
|
|
119
|
+
3. **People** — assignee, decision_makers, attendees
|
|
120
|
+
4. **Values** — deal_value, fees, budget
|
|
121
|
+
|
|
122
|
+
Low-priority (often intentionally omitted):
|
|
123
|
+
- Tags, notes, optional descriptions
|
|
124
|
+
- Status (user may want to set this themselves)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: gather-context
|
|
3
|
+
description: Gather full context on named entities before taking action
|
|
4
|
+
loading: eager
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Context Gathering
|
|
8
|
+
|
|
9
|
+
When a user references a specific named entity in their request, gather full context before proceeding:
|
|
10
|
+
|
|
11
|
+
## When to Gather Context
|
|
12
|
+
|
|
13
|
+
User mentions a specific entity by name:
|
|
14
|
+
- "Help me write a proposal for Acme"
|
|
15
|
+
- "Create a deck for the FII10 project"
|
|
16
|
+
- "What's the status of the Meridian Health deliverables?"
|
|
17
|
+
- "Find all open tasks for the Terra Finance project"
|
|
18
|
+
|
|
19
|
+
## What to Gather
|
|
20
|
+
|
|
21
|
+
1. **Fetch the named entity** — use `get_entity` to load the full record
|
|
22
|
+
2. **Pull related entities** — use `get_backlinks` to find connections:
|
|
23
|
+
- For clients: related projects, deals, contacts, proposals
|
|
24
|
+
- For projects: client, deliverables, artifacts, meetings, decisions, tasks
|
|
25
|
+
- For deals: client, contacts, proposal documents
|
|
26
|
+
3. **Check recent activity** — search for recent meetings, decisions, or tasks related to the entity
|
|
27
|
+
4. **Load memory context** — check if there's relevant session memory about this entity
|
|
28
|
+
|
|
29
|
+
## Example Flow
|
|
30
|
+
|
|
31
|
+
User: "Help me write a proposal for Acme"
|
|
32
|
+
|
|
33
|
+
**Before writing anything:**
|
|
34
|
+
1. `get_entity({ repo: "clients", entityType: "client", entityId: "acme" })`
|
|
35
|
+
2. `get_backlinks({ repo: "clients", entityType: "client", entityId: "acme" })`
|
|
36
|
+
3. `search_entities({ query: "Acme", entityTypes: ["deal", "project", "person", "proposal"] })`
|
|
37
|
+
4. Review memory for past Acme conversations
|
|
38
|
+
|
|
39
|
+
**Then proceed** with full context to draft the proposal.
|
|
40
|
+
|
|
41
|
+
## Important
|
|
42
|
+
|
|
43
|
+
- Don't make assumptions about entity details — fetch them first
|
|
44
|
+
- A few seconds gathering context saves minutes of back-and-forth
|
|
45
|
+
- If the entity doesn't exist, offer to create it before proceeding
|
|
46
|
+
- Present a brief context summary to the user before taking action: "I see Acme is a prospect with two past deals and three contacts on file. Let me draft a proposal..."
|