@minhpnq1807/contextos 0.1.6 → 0.1.7

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.7
4
+
5
+ - Filters documentation-only AGENTS entries such as MCP tool headings, HTML comments, generic "Key Tools" headings, and tool reference tables before scoring.
6
+ - Keeps actionable tool instructions, for example `Use detect_changes for code review`, measurable through MCP telemetry.
7
+
3
8
  ## 0.1.6
4
9
 
5
10
  - Adds a transparent stdio MCP telemetry proxy that records `tools/call` events while forwarding requests to the original MCP server.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minhpnq1807/contextos",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Task-aware AGENTS.md context injection and compliance reporting for Codex.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -62,6 +62,25 @@ const SYSTEM_USER_RULE_PATTERNS = [
62
62
  /\bminh_dev\b/i
63
63
  ];
64
64
 
65
+ const DOCUMENTATION_HEADING_PATTERNS = [
66
+ /^mcp\s+tools?\s*:/i,
67
+ /^key\s+tools?$/i,
68
+ /^workflow$/i,
69
+ /^tools?$/i
70
+ ];
71
+
72
+ const TOOL_REFERENCE_TOKENS = new Set([
73
+ "detect_changes",
74
+ "get_review_context",
75
+ "get_impact_radius",
76
+ "get_affected_flows",
77
+ "query_graph",
78
+ "semantic_search_nodes",
79
+ "get_architecture_overview",
80
+ "refactor_tool",
81
+ "list_communities"
82
+ ]);
83
+
65
84
  export function tokenize(value) {
66
85
  const normalized = String(value || "")
67
86
  .toLowerCase()
@@ -155,6 +174,7 @@ export function parseRules(markdown) {
155
174
  export function filterActionableRules(rules = []) {
156
175
  return rules
157
176
  .filter((rule) => !isSystemUserRule(rule))
177
+ .filter((rule) => !isDocumentationOnlyRule(rule))
158
178
  .map((rule, index) => ({ ...rule, id: `r${index + 1}`, originalOrder: index }));
159
179
  }
160
180
 
@@ -163,6 +183,32 @@ export function isSystemUserRule(rule) {
163
183
  return SYSTEM_USER_RULE_PATTERNS.some((pattern) => pattern.test(String(content || "")));
164
184
  }
165
185
 
186
+ export function isDocumentationOnlyRule(rule) {
187
+ const content = String(typeof rule === "string" ? rule : rule?.content || "").trim();
188
+ const normalized = stripMarkdownEmphasis(content);
189
+ if (!normalized) return true;
190
+ if (/^<!--.*-->$/.test(normalized)) return true;
191
+ if (DOCUMENTATION_HEADING_PATTERNS.some((pattern) => pattern.test(normalized))) return true;
192
+ if (isMarkdownTableRule(normalized)) return true;
193
+ return false;
194
+ }
195
+
196
+ function stripMarkdownEmphasis(content) {
197
+ return String(content || "")
198
+ .replace(/^#+\s+/, "")
199
+ .replace(/^\*\*(.*)\*\*$/, "$1")
200
+ .trim();
201
+ }
202
+
203
+ function isMarkdownTableRule(content) {
204
+ if (!content.includes("|")) return false;
205
+ const pipeCount = (content.match(/\|/g) || []).length;
206
+ if (pipeCount < 4) return false;
207
+ const lower = content.toLowerCase();
208
+ const toolReferenceCount = [...TOOL_REFERENCE_TOKENS].filter((token) => lower.includes(token)).length;
209
+ return /\btool\b/.test(lower) && /\buse\s+when\b/.test(lower) && toolReferenceCount >= 2;
210
+ }
211
+
166
212
  function dedupeRules(rules) {
167
213
  const seen = new Set();
168
214
  return rules.filter((rule) => {