promptgraph-mcp 2.9.60 → 2.9.62

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # PromptGraph
2
2
 
3
- **Semantic skill router and marketplace for Claude Code and OpenCode.**
3
+ **Semantic skill router and marketplace for Claude Code, Claude Desktop, and OpenCode.**
4
4
 
5
5
  Instead of loading every `.md` skill into context, Claude calls `pg_search` and loads only the skill it needs — saving 20k+ tokens per session.
6
6
 
@@ -18,7 +18,7 @@ Instead of loading every `.md` skill into context, Claude calls `pg_search` and
18
18
  - **Any local folder** — `pg add-dir <path>` indexes a folder that isn't a default source
19
19
  - **Marketplace** — browse and install community skill bundles via TUI or MCP tools
20
20
  - **Publishing** — publish skills/bundles to the registry hands-off via GitHub CLI
21
- - **Multi-platform** — verified on Claude Code & OpenCode; best-effort config for Claude Desktop, Cursor, Windsurf, Cline, Codex
21
+ - **Multi-platform** — verified on Claude Code, Claude Desktop & OpenCode; best-effort config for Cursor, Windsurf, Cline, Codex
22
22
 
23
23
  ---
24
24
 
@@ -48,13 +48,13 @@ Then restart your editor — the `promptgraph` MCP server will be available.
48
48
 
49
49
  ## Supported platforms
50
50
 
51
- Only **Claude Code** and **OpenCode** are verified end-to-end. The others are best-effort — the MCP config path/format is implemented but untested, so `pg setup` warns before writing. If you run one, please [report results](https://github.com/NeiP4n/promptgraph/issues).
51
+ **Claude Code**, **Claude Desktop**, and **OpenCode** are verified end-to-end. The others are best-effort — the MCP config path/format is implemented but untested, so `pg setup` warns before writing. If you run one, please [report results](https://github.com/NeiP4n/promptgraph/issues).
52
52
 
53
53
  | Platform | Status | Config written | Skills directory |
54
54
  |---|---|---|---|
55
55
  | `claude-code` | ✅ verified | `~/.claude/settings.json` | `~/.claude/skills-store` |
56
+ | `claude-desktop` | ✅ verified | `claude_desktop_config.json` (OS-specific) | `~/.claude/skills-store` |
56
57
  | `opencode` | ✅ verified | `~/.config/opencode/opencode.json` | `~/.config/opencode/skills` |
57
- | `claude-desktop` | ⚠️ untested | `claude_desktop_config.json` (OS-specific) | `~/.claude/skills-store` |
58
58
  | `cursor` | ⚠️ untested | `~/.cursor/mcp.json` | `~/.cursor/skills` |
59
59
  | `windsurf` | ⚠️ untested | `~/.codeium/windsurf/mcp_config.json` | `~/.codeium/windsurf/skills` |
60
60
  | `cline` | ⚠️ untested | `~/.vscode/mcp.json` | `~/.vscode/skills` |
@@ -128,6 +128,24 @@ Your **skill files** stay wherever you put them (the platform skills dir or any
128
128
 
129
129
  ---
130
130
 
131
+ ## Skill orchestration — `pg` → `pg-chain`
132
+
133
+ `pg setup` installs two router skills:
134
+
135
+ - **`pg`** — single lookup: search → read → execute one skill for a task.
136
+ - **`pg-chain`** — orchestrator: wraps `pg` in a controlled loop for **multi-step** tasks. The model runs a skill, reassesses, finds the next skill, runs it, and repeats **until the goal is met** — following explicit skill chains (`pg_callees`) and discovering new ones (`pg_search`) as needs emerge.
137
+
138
+ `pg-chain` has hard stop conditions so it can't loop forever: goal met, max 7 skills per chain, a repeat-guard (never re-run the same skill on the same sub-task), and a no-progress guard. It keeps a visible `Goal / Done / Now / Left` ledger so the chain is auditable.
139
+
140
+ ```
141
+ "Add a feature flag, make sure nothing broke, and write the commit."
142
+ → feature-flag ✓ → safe-verify ✓ → commit-message ✓ (3 skills chained)
143
+ ```
144
+
145
+ Use `pg` for one-step tasks, `pg-chain` when a request clearly spans several skills.
146
+
147
+ ---
148
+
131
149
  ## OpenCode — `/pg` slash commands
132
150
 
133
151
  After `pg setup opencode`, two slash commands are available inside OpenCode:
package/commands/setup.js CHANGED
@@ -1,5 +1,39 @@
1
1
  import { colors, success, error, info, section } from '../cli.js';
2
2
  import chalk from 'chalk';
3
+ import fs from 'fs';
4
+ import os from 'os';
5
+ import path from 'path';
6
+ import { fileURLToPath } from 'url';
7
+
8
+ // Install the bundled router skills (pg, pg-chain) so a fresh install actually
9
+ // has the orchestration capability — not just docs that reference it.
10
+ // Copies into skillsDir (indexed → discoverable via pg_search on every platform)
11
+ // and, on Claude platforms, into ~/.claude/commands (so /pg & /pg-chain slash
12
+ // commands work). Never overwrites a user-edited copy.
13
+ function installRouterSkills(skillsDir, platformId) {
14
+ const pkgRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
15
+ const srcDir = path.join(pkgRoot, 'skills');
16
+ if (!fs.existsSync(srcDir)) return;
17
+ const files = fs.readdirSync(srcDir).filter(f => f.endsWith('.md'));
18
+
19
+ const targets = [path.join(skillsDir, '_promptgraph')];
20
+ if (platformId === 'claude-code' || platformId === 'claude-desktop') {
21
+ targets.push(path.join(os.homedir(), '.claude', 'commands'));
22
+ }
23
+
24
+ let installed = 0;
25
+ for (const dir of targets) {
26
+ fs.mkdirSync(dir, { recursive: true });
27
+ for (const f of files) {
28
+ const dest = path.join(dir, f);
29
+ // Don't clobber a copy the user has customized; refresh only if missing/identical-origin.
30
+ if (fs.existsSync(dest)) continue;
31
+ fs.copyFileSync(path.join(srcDir, f), dest);
32
+ installed++;
33
+ }
34
+ }
35
+ if (installed) success(`Installed router skills (${files.map(f => f.replace('.md', '')).join(', ')})`);
36
+ }
3
37
 
4
38
  export default async function handler(args, bin) {
5
39
  const { detectPlatforms, PLATFORMS } = await import('../platform.js');
@@ -14,8 +48,8 @@ export default async function handler(args, bin) {
14
48
  info(`${chalk.white(p.id.padEnd(16))} ${chalk.gray(p.name.padEnd(20))} ${tag}`);
15
49
  });
16
50
  console.log(chalk.gray('\n Usage: pg setup <platform>'));
17
- console.log(chalk.green(' Verified: ') + chalk.gray('claude-code, opencode'));
18
- console.log(chalk.yellow(' Untested: ') + chalk.gray('claude-desktop, cursor, windsurf, cline, codex') + chalk.gray(' (best-effort — please report results)\n'));
51
+ console.log(chalk.green(' Verified: ') + chalk.gray('claude-code, claude-desktop, opencode'));
52
+ console.log(chalk.yellow(' Untested: ') + chalk.gray('cursor, windsurf, cline, codex') + chalk.gray(' (best-effort — please report results)\n'));
19
53
  process.exit(0);
20
54
  }
21
55
 
@@ -23,7 +57,7 @@ export default async function handler(args, bin) {
23
57
  if (!platform) { error(`Unknown platform: ${platformId}`); process.exit(1); }
24
58
 
25
59
  if (!platform.verified) {
26
- console.log(chalk.yellow(` ⚠ ${platform.name} is untested.`) + chalk.gray(' Only claude-code and opencode are verified.'));
60
+ console.log(chalk.yellow(` ⚠ ${platform.name} is untested.`) + chalk.gray(' Verified: claude-code, claude-desktop, opencode.'));
27
61
  console.log(chalk.gray(` The MCP config format/path below is best-effort and may need manual fixing.`));
28
62
  console.log(chalk.gray(` If it works (or doesn't), please report: https://github.com/NeiP4n/promptgraph/issues\n`));
29
63
  }
@@ -43,6 +77,9 @@ export default async function handler(args, bin) {
43
77
  success(`Skills directory: ${chalk.white(skillsDir)}`);
44
78
  info(chalk.gray(' Marketplace installs and pg import will save here'));
45
79
 
80
+ // 2b. Install bundled router skills (pg + pg-chain orchestrator)
81
+ try { installRouterSkills(skillsDir, platformId); } catch (e) { info(chalk.gray(` (router skills skipped: ${e.message})`)); }
82
+
46
83
  // 3. Reindex
47
84
  console.log(chalk.gray('\n Indexing skills...\n'));
48
85
  await indexAll();
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "promptgraph-mcp",
3
- "version": "2.9.60",
3
+ "version": "2.9.62",
4
4
  "files": [
5
5
  "*.js",
6
6
  "commands/",
7
7
  "src/",
8
+ "skills/",
8
9
  "README.md",
9
10
  ".claude-plugin/",
10
11
  ".mcp.json"
package/platform.js CHANGED
@@ -59,7 +59,7 @@ export const PLATFORMS = {
59
59
  name: 'Claude Desktop',
60
60
  configPath: getClaudeDesktopConfig(),
61
61
  addMcp: (config) => addStdMcp(config.configPath),
62
- verified: false,
62
+ verified: true,
63
63
  },
64
64
  'cline': {
65
65
  name: 'Cline (VS Code)',
@@ -0,0 +1,94 @@
1
+ ---
2
+ name: pg-chain
3
+ description: Skill orchestrator — chains skills in a loop (search → execute → reassess → next) until the whole task is done
4
+ ---
5
+
6
+ # PromptGraph Chain Orchestrator
7
+
8
+ Use this when a request needs **more than one skill** to finish — a multi-step task
9
+ where you execute one skill, then discover you need another, and another, until the
10
+ goal is met. Builds on the `pg` router (single lookup) by wrapping it in a controlled loop.
11
+
12
+ ## The loop
13
+
14
+ ```
15
+ 1. PLAN → restate the goal in one sentence + list the obvious sub-tasks.
16
+ 2. SELECT → take the next unfinished sub-task.
17
+ 3. FIND → pg_search(<sub-task in English keywords>).
18
+ score ≥ 0.60 → use the skill | score < 0.60 → handle directly (no skill).
19
+ 4. CHAIN? → pg_callees(<skill id>) — does this skill explicitly call others?
20
+ If yes, those are the next chain links (follow them before re-searching).
21
+ 5. EXECUTE → Read the skill file at `path` (MANDATORY), then run its instructions fully.
22
+ 6. REASSESS → Is the GOAL complete?
23
+ • Done → STOP, summarize what was chained.
24
+ • Gap remains → name the next sub-task, go to step 2.
25
+ • Stuck/no skill → handle directly, or report the blocker and STOP.
26
+ ```
27
+
28
+ ## Stop conditions (hard — never skip)
29
+
30
+ The loop **must** terminate. Stop when ANY of these is true:
31
+
32
+ - **Goal met** — the original request is fully satisfied (state it explicitly).
33
+ - **Max 7 skill executions** in one chain. If you hit 7, stop and report progress + what's left.
34
+ - **No progress** — if a sub-task's skill ran but the goal didn't move closer, do NOT
35
+ re-run the same skill. Mark it tried, pick a different approach or stop.
36
+ - **Repeat guard** — keep a list of executed skill ids. Never execute the same skill id
37
+ twice for the same sub-task. Re-running a skill on identical input is a loop, not progress.
38
+ - **No match + can't proceed** — if `pg_search` < 0.60 and you can't handle it directly, stop and ask the user.
39
+
40
+ ## State to track out loud
41
+
42
+ Keep a short visible ledger so the chain is auditable:
43
+
44
+ ```
45
+ Goal: <one sentence>
46
+ Done: [skill-a ✓, skill-b ✓]
47
+ Now: <current sub-task> → <skill being used>
48
+ Left: <remaining sub-tasks, or "none">
49
+ ```
50
+
51
+ Update it after every EXECUTE step. This is what prevents silent infinite loops.
52
+
53
+ ## Two ways skills connect
54
+
55
+ 1. **Explicit chain** — a skill's file references another skill (e.g. `/run-tests`).
56
+ `pg_callees` surfaces these. Follow declared chains first — the author intended them.
57
+ 2. **Emergent need** — mid-task you realize you need something new. `pg_search` for it.
58
+ This is where the orchestrator earns its keep.
59
+
60
+ Prefer explicit chains (deterministic) over emergent search (discovered) when both apply.
61
+
62
+ ## Worked example
63
+
64
+ ```
65
+ User: "Add a feature flag, then make sure nothing broke and write the commit."
66
+
67
+ Goal: ship a feature flag safely with a commit.
68
+ Done: []
69
+ Now: add a feature flag → pg_search("add feature flag toggle config")
70
+ → feature-flag (0.81) → Read → execute. Done: [feature-flag ✓]
71
+ Reassess: code changed but untested.
72
+ Now: verify nothing broke → pg_search("run tests verify no regression")
73
+ → safe-verify (0.78) → Read → execute. Done: [feature-flag ✓, safe-verify ✓]
74
+ Reassess: tests green, change not committed.
75
+ Now: write commit → pg_search("write git commit message")
76
+ → commit-message (0.91) → Read → execute. Done: [..., commit-message ✓]
77
+ Reassess: GOAL MET → STOP.
78
+
79
+ Summary: chained feature-flag → safe-verify → commit-message (3 skills).
80
+ ```
81
+
82
+ ## When NOT to chain
83
+
84
+ - Single-skill tasks → just use `pg` (this orchestrator is overhead for one step).
85
+ - Pure-knowledge questions with no skill match → answer directly.
86
+ - If two sub-tasks are independent, you may do them in either order — don't invent
87
+ false dependencies.
88
+
89
+ ## Honesty rules
90
+
91
+ - A skill running ≠ the sub-task being done. Verify the **outcome**, then advance.
92
+ - If no skill fits a step, say so and handle it directly — do not force a low-score skill
93
+ just to keep the chain going.
94
+ - Report the final chain (which skills, in what order) so the user can audit it.
package/skills/pg.md ADDED
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: pg
3
+ description: PromptGraph router — finds and loads the right skill for any task
4
+ ---
5
+
6
+ # PromptGraph Router
7
+
8
+ You have access to a semantic skill index via the `promptgraph` MCP server tools.
9
+
10
+ ## Step-by-step for every task
11
+
12
+ 1. **Translate** the user's request to English keywords (if needed)
13
+ 2. **Call `pg_search`** with those keywords
14
+ 3. **Evaluate results:**
15
+ - score ≥ 0.75 → use it, high confidence
16
+ - score 0.60–0.74 → use it, but stay alert if instructions feel off-topic
17
+ - score < 0.60 → skip, handle the task directly
18
+ 4. **Read the skill file** at the returned `path` using the Read tool — **MANDATORY. Do NOT skip this step even if the task seems obvious. Saying "using skill X" and then doing the task from memory is a protocol violation.**
19
+ 5. **Execute** the skill's instructions fully
20
+
21
+ ## Score thresholds
22
+
23
+ | Score | Action |
24
+ |---|---|
25
+ | ≥ 0.75 | Use skill, high confidence |
26
+ | 0.60–0.74 | Use skill, verify relevance |
27
+ | < 0.60 | Handle directly, no skill |
28
+
29
+ ## Search query tips
30
+
31
+ - Write in English — the embedding model is English-only
32
+ - Use task-oriented phrases: "refactor without breaking tests", "debug memory leak", "write commit message"
33
+ - If first search returns low scores, try a shorter or more specific query
34
+
35
+ ## Available MCP tools
36
+
37
+ | Tool | When to use |
38
+ |---|---|
39
+ | `pg_search` | Find a skill by task description — **always start here** |
40
+ | `pg_context` | Get full details + callers/callees for a known skill id |
41
+ | `pg_callers` | Which skills reference this one (dependency check) |
42
+ | `pg_callees` | Which skills this one calls (before executing a chain) |
43
+ | `pg_impact` | What breaks if a skill changes |
44
+ | `pg_list` | List all indexed skills (use when unsure what's available) |
45
+ | `pg_top_rated` | Best-rated skills by success/fail ratio |
46
+ | `pg_marketplace_browse` | Browse community registry |
47
+ | `pg_marketplace_install` | Install by code (`pg-xxxxxx`), id, or name |
48
+ | `pg_bundle_install` | Install a skill bundle |
49
+
50
+ ## Skill sources indexed
51
+
52
+ - `~/.claude/commands/` — local command skills
53
+ - `~/.claude/skills-store/` — personal skills
54
+ - `~/.claude/skills-store/github/alirezarezvani-claude-skills` — 330+ engineering, product, marketing, compliance skills
55
+ - `~/.claude/skills-store/github/trailofbits-skills` — security research and audit skills
56
+ - `~/.claude/skills-store/github/OthmanAdi-planning-with-files` — project planning skills
57
+ - `~/.claude/skills-store/marketplace/` — installed community skills
58
+
59
+ ## Examples
60
+
61
+ ```
62
+ User: "отрефактори этот модуль без багов"
63
+ → pg_search("safe refactor without breaking tests")
64
+ → returns safe-refactor (score: 0.82) → Read → execute
65
+
66
+ User: "напиши commit message"
67
+ → pg_search("write git commit message")
68
+ → returns commit-message (score: 0.91) → Read → execute
69
+
70
+ User: "аудит безопасности кода"
71
+ → pg_search("security audit vulnerability scan")
72
+ → returns audit (score: 0.80) → Read → execute
73
+
74
+ User: "спланируй проект"
75
+ → pg_search("project planning breakdown tasks")
76
+ → returns planning skill → Read → execute
77
+ ```
78
+
79
+ ## If no skill matches (score < 0.60)
80
+
81
+ Handle the task directly with your own knowledge. Do not force a low-score skill.
82
+
83
+ ## Multi-step tasks → use `pg-chain`
84
+
85
+ This router loads **one** skill. If the task needs several skills in sequence
86
+ (execute one → discover you need another → continue until done), switch to the
87
+ **`pg-chain`** orchestrator skill — it wraps this lookup in a controlled loop with
88
+ hard stop conditions. `pg` = single lookup; `pg-chain` = chained execution.