sp-rag 0.6.4 → 0.6.6

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
@@ -17,7 +17,7 @@ CLI để setup nhanh SP-RAG theo hướng dev-friendly:
17
17
  ## Trạng thái package
18
18
 
19
19
  - package npm public: `sp-rag`
20
- - version đang publish: `0.6.4`
20
+ - version đang publish: `0.6.6`
21
21
  - binary public: `sp-rag`
22
22
 
23
23
  ## Cài từ source trong monorepo
@@ -70,6 +70,8 @@ Ghi chú:
70
70
 
71
71
  - với `cursor` và `vscode` ở `scope project`, nếu Sếpp đang đứng sẵn trong repo thì có thể bỏ `--cwd`
72
72
  - CLI sẽ tự dùng thư mục hiện tại cho cả MCP lẫn skill
73
+ - rule/agent mới đã được tăng độ ưu tiên MCP-first, giảm khả năng model nhảy thẳng sang grep/read file local
74
+ - skill mới cũng dặn model tổng hợp từ `matched_passages`, `top_entities`, `top_relations`, `citations`; không bê nguyên `answer_brief`
73
75
 
74
76
  Ví dụ:
75
77
 
package/dist/cli.js CHANGED
@@ -4,7 +4,7 @@ import { runEvaluationSuite } from './lib/eval.js';
4
4
  import { defaultBaseUrl, defaultMcpServerAlias, defaultMcpUrl, installMcpConfig, resolveMcpConfigPath, } from './lib/mcp-config.js';
5
5
  import { fetchJson, fetchText, runDoctor } from './lib/http.js';
6
6
  import { installSkill, resolveSkillInstallTarget, } from './lib/skill.js';
7
- const cliVersion = '0.6.4';
7
+ const cliVersion = '0.6.6';
8
8
  function parseArgv(argv) {
9
9
  const positionals = [];
10
10
  const options = {};
package/dist/lib/skill.js CHANGED
@@ -62,7 +62,7 @@ export function defaultSkillDir(client = 'codex', cwd, scope) {
62
62
  function renderSkillMarkdown(context) {
63
63
  return `---
64
64
  name: sp-rag
65
- description: Use SP-RAG whenever the user asks about this codebase, internal business domain, rendered docs, import inventory, or codegraph sync status. Prefer MCP-backed evidence before answering from memory.
65
+ description: Use SP-RAG whenever the user asks about this codebase, internal business domain, rendered docs, import inventory, or codegraph sync status. You must call SP-RAG MCP tools first before answering from memory or reading local files.
66
66
  ---
67
67
 
68
68
  # SP-RAG
@@ -85,30 +85,36 @@ Docs URL: \`${context.docsUrl}\`
85
85
  3. Use \`get_rendered_docs\` for public, function, or dev docs that were already rendered from the latest graph.
86
86
  4. Use \`get_sync_status\`, \`get_sync_runs\`, or \`get_sync_metrics\` when you need to verify commit freshness, investigate failures, or inspect operational history.
87
87
  5. Only call \`trigger_code_graph_sync\` when the user explicitly asks to refresh the graph or when a stale graph is the confirmed blocker.
88
+ 6. After \`query_context\` returns, synthesize the final answer from \`matched_passages\`, \`top_entities\`, \`top_relations\`, and \`citations\`. Treat \`answer_brief\` as a hint only.
88
89
 
89
90
  ## Guardrails
90
91
 
92
+ - You must call SP-RAG MCP tools first for codebase or domain questions before using local workspace search, grep, or file reads.
91
93
  - Prefer MCP-grounded answers before relying on memory.
94
+ - Treat \`answer_brief\` as a hint only. Prefer the richer evidence in \`matched_passages\`, \`top_entities\`, \`top_relations\`, and \`citations\` when writing the final answer.
92
95
  - If the evidence may be stale, say so clearly and mention that the graph or docs may need a refresh.
93
96
  - Do not trigger sync or import actions unless the user asked for it or the workflow truly requires it.
94
97
  - When rendered docs already answer the question, cite or summarize those docs instead of rewriting everything from scratch.
98
+ - Only fall back to local workspace search or file reads after MCP is unavailable or clearly lacks the needed evidence, and say that you are falling back.
95
99
  `;
96
100
  }
97
101
  function renderCursorRule(context) {
98
102
  return `---
99
103
  description: Use SP-RAG when the request is about this codebase, internal business workflows, rendered docs, import inventory, or codegraph sync status.
100
104
  globs:
101
- alwaysApply: false
105
+ alwaysApply: true
102
106
  ---
103
107
 
104
108
  # SP-RAG
105
109
 
106
- - Prefer the \`${context.serverAlias}\` MCP server at \`${context.mcpUrl}\` before answering from memory.
110
+ - You must call the \`${context.serverAlias}\` MCP server first before using local workspace search, grep, or file reads for codebase and domain questions.
107
111
  - Use rendered docs from \`${context.docsUrl}\` when documentation already answers the question.
108
112
  - For architecture, domain, entities, relations, and business workflow questions, query MCP first and only then synthesize the answer.
113
+ - Treat \`answer_brief\` only as a hint. Build the final answer from \`matched_passages\`, \`top_entities\`, \`top_relations\`, and \`citations\`.
109
114
  - For freshness or operational questions, check sync status, recent runs, and metrics before assuming the graph is current.
110
115
  - Only trigger codegraph sync when the user explicitly asks for it or stale evidence is the confirmed blocker.
111
116
  - If the evidence may be stale, say so clearly.
117
+ - Only fall back to local workspace search after MCP is unavailable or clearly lacks the needed evidence, and say that you are falling back.
112
118
  `;
113
119
  }
114
120
  function renderVsCodeAgent(context) {
@@ -122,6 +128,8 @@ You are the SP-RAG custom agent for this workspace.
122
128
 
123
129
  Use the \`${context.serverAlias}\` MCP server at \`${context.mcpUrl}\` and the rendered docs URL \`${context.docsUrl}\` as your grounded source of truth.
124
130
 
131
+ You must call an SP-RAG MCP tool before using local workspace search, grep, or file reads for codebase and domain questions.
132
+
125
133
  ## Recommended Workflow
126
134
 
127
135
  1. Start with \`healthz\` if connectivity or freshness is uncertain.
@@ -129,13 +137,17 @@ Use the \`${context.serverAlias}\` MCP server at \`${context.mcpUrl}\` and the r
129
137
  3. Use \`get_rendered_docs\` when public, function, or dev docs may already answer the question.
130
138
  4. Use \`get_sync_status\`, \`get_sync_runs\`, or \`get_sync_metrics\` for freshness, incident review, or operational debugging.
131
139
  5. Trigger codegraph sync only when the user explicitly requests a refresh or stale evidence is the confirmed blocker.
140
+ 6. After \`query_context\` returns, synthesize the final answer from \`matched_passages\`, \`top_entities\`, \`top_relations\`, and \`citations\`. Treat \`answer_brief\` as a hint.
132
141
 
133
142
  ## Guardrails
134
143
 
135
144
  - Prefer MCP-grounded evidence before answering from memory.
145
+ - Treat \`answer_brief\` as a hint. Prefer the richer evidence in \`matched_passages\`, \`top_entities\`, \`top_relations\`, and \`citations\` when writing the final answer.
146
+ - Do not use local workspace search, grep, or file reads until SP-RAG MCP has been tried first for the current question.
136
147
  - When evidence may be stale, say so clearly and mention that a refresh might be needed.
137
148
  - Do not trigger sync or import actions unless the workflow truly requires it.
138
149
  - When rendered docs already answer the question, summarize those docs instead of rewriting everything from scratch.
150
+ - Only fall back to local workspace search or file reads after MCP is unavailable or clearly lacks the needed evidence, and say that you are falling back.
139
151
  `;
140
152
  }
141
153
  function renderSkillArtifact(context) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sp-rag",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "CLI cho setup MCP, codegraph GitNexus và skill của SP-RAG",
5
5
  "type": "module",
6
6
  "files": [