drafted 1.7.16 → 1.7.18
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/agent-instructions/global.md +50 -0
- package/cli/drafted.mjs +12 -4
- package/install-mcp.sh +719 -34
- package/mcp/server.mjs +399 -63
- package/package.json +15 -3
- package/src/shared/constants.mjs +7 -5
- package/src/shared/excalidraw.mjs +101 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<drafted>
|
|
2
|
+
Drafted is the shared workspace for agent-produced consulting artifacts. Claude Code and Codex agents should use it proactively when the task benefits from persistent visual work, client-facing documents, reusable skills, or organization knowledge.
|
|
3
|
+
|
|
4
|
+
Drafted terminology:
|
|
5
|
+
- Wiki: durable organization knowledge. It may also be called the knowledge base or database. Save, compound, curate, and retrieve knowledge here when it should benefit the business, teammates, other agents, or future work by the same person.
|
|
6
|
+
- Skills: reusable operating knowledge. Users may call them skills, procedures, SOPs, standard operating procedures, checklists, methods, protocols, playbooks, or templates for repeatable work. Use them actively before repeatable work, follow them while working, and maintain them when better methods emerge.
|
|
7
|
+
- Projects: client-facing or reviewable work products, organized as frames on a shared surface. Use projects when work should be seen, reviewed, reused, or developed over time rather than left only in chat.
|
|
8
|
+
|
|
9
|
+
Operating principle:
|
|
10
|
+
- Do not treat Drafted as passive storage. Actively use and maintain the wiki, skills, and projects when they fit the work.
|
|
11
|
+
- Default to creating or updating Drafted project frames for substantive outputs instead of leaving artifacts only in chat. If the user asks you to draft, write, plan, analyze, compare, design, document, summarize, report, spec, model, or make a deck/table, put the durable result on the Drafted surface unless the user explicitly wants chat-only output.
|
|
12
|
+
- Put durable knowledge in the wiki, reusable methods in skills, and producible artifacts in projects.
|
|
13
|
+
- Do not save reusable procedures, SOPs, checklists, methods, protocols, or repeatable work instructions to the wiki/knowledge base. Save them as Drafted skills.
|
|
14
|
+
|
|
15
|
+
Before working:
|
|
16
|
+
- Check whether Drafted MCP tools are available. If not authenticated, use auth(action="get_link") or auth(action="login") and give the user the sign-in link.
|
|
17
|
+
- Select the correct organization first. Use get_org(action="get") and project(action="list") to identify the target org/project. Opening a project switches org context automatically; for wiki/skill-only work, use get_org(action="switch", orgId=...).
|
|
18
|
+
- Check get_org(action="get") for googleDrive.connected. When Google Drive is connected for the active org, Google Workspace frames are available and should be the strong default for documents, spreadsheets, and presentations.
|
|
19
|
+
- Never assume the current active Drafted project or organization is correct. Verify the returned project/org before writing.
|
|
20
|
+
|
|
21
|
+
Wiki rules:
|
|
22
|
+
- Search the org wiki before substantive work: wiki(action="search") with relevant keywords.
|
|
23
|
+
- Read relevant pages before creating or changing artifacts.
|
|
24
|
+
- Maintain the wiki when you discover durable knowledge, decisions, client constraints, project context, research notes, or facts that should compound for the business or future agents.
|
|
25
|
+
- When creating or editing wiki pages, return a browser link the user can click.
|
|
26
|
+
|
|
27
|
+
Skill rules:
|
|
28
|
+
- Treat skill, procedure, SOP, checklist, method, protocol, playbook, and repeatable-work template as the same user intent.
|
|
29
|
+
- Search skills before starting repeatable work: skill(action="search") or skill(action="list").
|
|
30
|
+
- Load and follow relevant skills with skill(action="load"). Read supporting skill files when needed.
|
|
31
|
+
- When the user asks to record, distill, create, save, install, or update a skill/procedure/SOP/checklist/method/protocol/playbook, create or update a Drafted skill for the org with skill tools.
|
|
32
|
+
- Improve skills when you find a better checklist, standard, or operating method.
|
|
33
|
+
|
|
34
|
+
Project/producible rules:
|
|
35
|
+
- For client-facing, durable, or reviewable artifacts, produce the work inside the appropriate Drafted project instead of leaving it only in chat.
|
|
36
|
+
- Prefer one visible frame per artifact or artifact section so the user can review, compare, and refine work on the surface.
|
|
37
|
+
- Use project(action="open") before frame/asset/connector/layout changes. For every write/edit, confirm the response project matches the intended project.
|
|
38
|
+
- Read anchored frames and existing neighboring frames before editing a layer.
|
|
39
|
+
- After creating frames, documents, diagrams, or other producibles, use focus when available and return the clickable Drafted frame or project link.
|
|
40
|
+
|
|
41
|
+
Google Workspace rules:
|
|
42
|
+
- If get_org reports googleDrive.connected, strongly prefer Google Workspace frames for business artifacts: google-doc for memos, reports, briefs, SOPs, proposals, and long-form documents; google-sheet for tables, trackers, budgets, research matrices, and models; google-slide for decks and presentation outlines.
|
|
43
|
+
- Create Google Workspace frames with frame(action="write", googleType="google-doc" | "google-sheet" | "google-slide", path="/{layer}/{lane}/{filename}", title="...") after opening the project.
|
|
44
|
+
- For flowcharts, process maps, architecture diagrams, system diagrams, data-flow diagrams, visual maps, or other editable diagrams, load and follow the system skill `excalidraw-drafted` (Drafted Excalidraw Diagram) and create native Drafted Excalidraw frames. Use normal Drafted HTML/markdown frames for web/UI mockups, rich visual layouts, or non-editable presentation artifacts.
|
|
45
|
+
- Use breadcrumbs in code or docs where useful: drafted:<frameId> for frames and drafted-project:<projectId> for projects.
|
|
46
|
+
|
|
47
|
+
Collaboration rules:
|
|
48
|
+
- Parallel agents must each open and verify their own Drafted project/org context.
|
|
49
|
+
- If there is any doubt about the correct org, project, wiki location, or skill, ask a short clarifying question before writing.
|
|
50
|
+
</drafted>
|
package/cli/drafted.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Drafted CLI
|
|
5
|
-
*
|
|
5
|
+
* Shared surface for agent-produced work, skills, and organization knowledge
|
|
6
6
|
*
|
|
7
7
|
* Extracted from Drafted VSCode extension and adapted for CLI use
|
|
8
8
|
*/
|
|
@@ -24,6 +24,13 @@ const DEFAULT_PROJECTS_FILE = join(DEFAULT_STATE_DIR, 'projects.json');
|
|
|
24
24
|
const DEFAULT_PID_FILE = join(DEFAULT_STATE_DIR, 'server.pid');
|
|
25
25
|
const DEFAULT_AUTH_FILE = join(DEFAULT_STATE_DIR, 'auth.json');
|
|
26
26
|
const DEFAULT_PORT = 3477;
|
|
27
|
+
const PACKAGE_VERSION = (() => {
|
|
28
|
+
try {
|
|
29
|
+
return JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf8')).version || 'unknown';
|
|
30
|
+
} catch {
|
|
31
|
+
return 'unknown';
|
|
32
|
+
}
|
|
33
|
+
})();
|
|
27
34
|
|
|
28
35
|
// Ensure state directory exists
|
|
29
36
|
if (!existsSync(DEFAULT_STATE_DIR)) {
|
|
@@ -390,7 +397,8 @@ program
|
|
|
390
397
|
const { openSync } = await import('fs');
|
|
391
398
|
const outLog = openSync(join(DEFAULT_STATE_DIR, 'server.log'), 'w');
|
|
392
399
|
const tsxPath = join(__dirname, '../node_modules/.bin/tsx');
|
|
393
|
-
const
|
|
400
|
+
const instrumentPath = join(__dirname, '../server/instrument.mjs');
|
|
401
|
+
const child = spawn(tsxPath, ['--import', instrumentPath, serverPath], {
|
|
394
402
|
detached: true,
|
|
395
403
|
stdio: ['ignore', outLog, outLog],
|
|
396
404
|
env: {
|
|
@@ -1022,8 +1030,8 @@ program
|
|
|
1022
1030
|
|
|
1023
1031
|
program
|
|
1024
1032
|
.name('drafted')
|
|
1025
|
-
.description('Drafted CLI -
|
|
1026
|
-
.version(
|
|
1033
|
+
.description('Drafted CLI - Shared surface for AI-human collaboration')
|
|
1034
|
+
.version(PACKAGE_VERSION);
|
|
1027
1035
|
|
|
1028
1036
|
program
|
|
1029
1037
|
.command('mcp-config')
|