@grafema/mcp 0.2.11 → 0.3.0-beta

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.
Files changed (158) hide show
  1. package/dist/analysis-worker.d.ts +4 -3
  2. package/dist/analysis-worker.d.ts.map +1 -1
  3. package/dist/analysis-worker.js +8 -203
  4. package/dist/analysis-worker.js.map +1 -1
  5. package/dist/analysis.d.ts +10 -3
  6. package/dist/analysis.d.ts.map +1 -1
  7. package/dist/analysis.js +130 -62
  8. package/dist/analysis.js.map +1 -1
  9. package/dist/config.d.ts +5 -11
  10. package/dist/config.d.ts.map +1 -1
  11. package/dist/config.js +6 -128
  12. package/dist/config.js.map +1 -1
  13. package/dist/definitions/analysis-tools.d.ts +6 -0
  14. package/dist/definitions/analysis-tools.d.ts.map +1 -0
  15. package/dist/definitions/analysis-tools.js +125 -0
  16. package/dist/definitions/analysis-tools.js.map +1 -0
  17. package/dist/definitions/context-tools.d.ts +6 -0
  18. package/dist/definitions/context-tools.d.ts.map +1 -0
  19. package/dist/definitions/context-tools.js +144 -0
  20. package/dist/definitions/context-tools.js.map +1 -0
  21. package/dist/definitions/graph-tools.d.ts +7 -0
  22. package/dist/definitions/graph-tools.d.ts.map +1 -0
  23. package/dist/definitions/graph-tools.js +124 -0
  24. package/dist/definitions/graph-tools.js.map +1 -0
  25. package/dist/definitions/graphql-tools.d.ts +6 -0
  26. package/dist/definitions/graphql-tools.d.ts.map +1 -0
  27. package/dist/definitions/graphql-tools.js +62 -0
  28. package/dist/definitions/graphql-tools.js.map +1 -0
  29. package/dist/definitions/guarantee-tools.d.ts +6 -0
  30. package/dist/definitions/guarantee-tools.d.ts.map +1 -0
  31. package/dist/definitions/guarantee-tools.js +136 -0
  32. package/dist/definitions/guarantee-tools.js.map +1 -0
  33. package/dist/definitions/index.d.ts +7 -0
  34. package/dist/definitions/index.d.ts.map +1 -0
  35. package/dist/definitions/index.js +24 -0
  36. package/dist/definitions/index.js.map +1 -0
  37. package/dist/definitions/knowledge-tools.d.ts +10 -0
  38. package/dist/definitions/knowledge-tools.d.ts.map +1 -0
  39. package/dist/definitions/knowledge-tools.js +300 -0
  40. package/dist/definitions/knowledge-tools.js.map +1 -0
  41. package/dist/definitions/notation-tools.d.ts +9 -0
  42. package/dist/definitions/notation-tools.d.ts.map +1 -0
  43. package/dist/definitions/notation-tools.js +62 -0
  44. package/dist/definitions/notation-tools.js.map +1 -0
  45. package/dist/definitions/project-tools.d.ts +6 -0
  46. package/dist/definitions/project-tools.d.ts.map +1 -0
  47. package/dist/definitions/project-tools.js +181 -0
  48. package/dist/definitions/project-tools.js.map +1 -0
  49. package/dist/definitions/query-tools.d.ts +6 -0
  50. package/dist/definitions/query-tools.d.ts.map +1 -0
  51. package/dist/definitions/query-tools.js +245 -0
  52. package/dist/definitions/query-tools.js.map +1 -0
  53. package/dist/definitions/types.d.ts +21 -0
  54. package/dist/definitions/types.d.ts.map +1 -0
  55. package/dist/definitions/types.js +5 -0
  56. package/dist/definitions/types.js.map +1 -0
  57. package/dist/dev-proxy.d.ts +29 -0
  58. package/dist/dev-proxy.d.ts.map +1 -0
  59. package/dist/dev-proxy.js +267 -0
  60. package/dist/dev-proxy.js.map +1 -0
  61. package/dist/handlers/analysis-handlers.d.ts.map +1 -1
  62. package/dist/handlers/analysis-handlers.js +34 -4
  63. package/dist/handlers/analysis-handlers.js.map +1 -1
  64. package/dist/handlers/context-handlers.d.ts +5 -6
  65. package/dist/handlers/context-handlers.d.ts.map +1 -1
  66. package/dist/handlers/context-handlers.js +19 -16
  67. package/dist/handlers/context-handlers.js.map +1 -1
  68. package/dist/handlers/coverage-handlers.js +1 -1
  69. package/dist/handlers/dataflow-handlers.d.ts +2 -0
  70. package/dist/handlers/dataflow-handlers.d.ts.map +1 -1
  71. package/dist/handlers/dataflow-handlers.js +68 -46
  72. package/dist/handlers/dataflow-handlers.js.map +1 -1
  73. package/dist/handlers/documentation-handlers.d.ts.map +1 -1
  74. package/dist/handlers/documentation-handlers.js +56 -2
  75. package/dist/handlers/documentation-handlers.js.map +1 -1
  76. package/dist/handlers/graph-handlers.d.ts +23 -0
  77. package/dist/handlers/graph-handlers.d.ts.map +1 -0
  78. package/dist/handlers/graph-handlers.js +155 -0
  79. package/dist/handlers/graph-handlers.js.map +1 -0
  80. package/dist/handlers/graphql-handlers.d.ts +9 -0
  81. package/dist/handlers/graphql-handlers.d.ts.map +1 -0
  82. package/dist/handlers/graphql-handlers.js +57 -0
  83. package/dist/handlers/graphql-handlers.js.map +1 -0
  84. package/dist/handlers/guarantee-handlers.js +1 -1
  85. package/dist/handlers/guard-handlers.d.ts.map +1 -1
  86. package/dist/handlers/guard-handlers.js +6 -3
  87. package/dist/handlers/guard-handlers.js.map +1 -1
  88. package/dist/handlers/index.d.ts +4 -0
  89. package/dist/handlers/index.d.ts.map +1 -1
  90. package/dist/handlers/index.js +6 -0
  91. package/dist/handlers/index.js.map +1 -1
  92. package/dist/handlers/issue-handlers.d.ts.map +1 -1
  93. package/dist/handlers/issue-handlers.js +10 -15
  94. package/dist/handlers/issue-handlers.js.map +1 -1
  95. package/dist/handlers/knowledge-handlers.d.ts +25 -0
  96. package/dist/handlers/knowledge-handlers.d.ts.map +1 -0
  97. package/dist/handlers/knowledge-handlers.js +208 -0
  98. package/dist/handlers/knowledge-handlers.js.map +1 -0
  99. package/dist/handlers/notation-handlers.d.ts +6 -0
  100. package/dist/handlers/notation-handlers.d.ts.map +1 -0
  101. package/dist/handlers/notation-handlers.js +53 -0
  102. package/dist/handlers/notation-handlers.js.map +1 -0
  103. package/dist/handlers/project-handlers.js +1 -1
  104. package/dist/handlers/query-handlers.d.ts.map +1 -1
  105. package/dist/handlers/query-handlers.js +166 -20
  106. package/dist/handlers/query-handlers.js.map +1 -1
  107. package/dist/prompts.js +1 -1
  108. package/dist/server.d.ts +19 -1
  109. package/dist/server.d.ts.map +1 -1
  110. package/dist/server.js +93 -3
  111. package/dist/server.js.map +1 -1
  112. package/dist/state.d.ts +10 -1
  113. package/dist/state.d.ts.map +1 -1
  114. package/dist/state.js +61 -8
  115. package/dist/state.js.map +1 -1
  116. package/dist/types.d.ts +75 -3
  117. package/dist/types.d.ts.map +1 -1
  118. package/dist/utils.d.ts +4 -0
  119. package/dist/utils.d.ts.map +1 -1
  120. package/dist/utils.js +18 -1
  121. package/dist/utils.js.map +1 -1
  122. package/package.json +4 -3
  123. package/src/analysis-worker.ts +9 -301
  124. package/src/analysis.ts +151 -77
  125. package/src/config.ts +6 -193
  126. package/src/definitions/analysis-tools.ts +127 -0
  127. package/src/definitions/context-tools.ts +147 -0
  128. package/src/definitions/graph-tools.ts +126 -0
  129. package/src/definitions/graphql-tools.ts +64 -0
  130. package/src/definitions/guarantee-tools.ts +138 -0
  131. package/src/definitions/index.ts +28 -0
  132. package/src/definitions/knowledge-tools.ts +302 -0
  133. package/src/definitions/notation-tools.ts +64 -0
  134. package/src/definitions/project-tools.ts +183 -0
  135. package/src/definitions/query-tools.ts +247 -0
  136. package/src/definitions/types.ts +22 -0
  137. package/src/dev-proxy.ts +336 -0
  138. package/src/handlers/analysis-handlers.ts +35 -4
  139. package/src/handlers/context-handlers.ts +19 -15
  140. package/src/handlers/coverage-handlers.ts +1 -1
  141. package/src/handlers/dataflow-handlers.ts +74 -56
  142. package/src/handlers/documentation-handlers.ts +56 -2
  143. package/src/handlers/graph-handlers.ts +212 -0
  144. package/src/handlers/graphql-handlers.ts +70 -0
  145. package/src/handlers/guarantee-handlers.ts +1 -1
  146. package/src/handlers/guard-handlers.ts +7 -3
  147. package/src/handlers/index.ts +6 -0
  148. package/src/handlers/issue-handlers.ts +10 -15
  149. package/src/handlers/knowledge-handlers.ts +242 -0
  150. package/src/handlers/notation-handlers.ts +71 -0
  151. package/src/handlers/project-handlers.ts +1 -1
  152. package/src/handlers/query-handlers.ts +186 -22
  153. package/src/prompts.ts +1 -1
  154. package/src/server.ts +126 -2
  155. package/src/state.ts +68 -8
  156. package/src/types.ts +98 -3
  157. package/src/utils.ts +22 -1
  158. package/src/definitions.ts +0 -665
@@ -0,0 +1,62 @@
1
+ /**
2
+ * GraphQL Tool — execute GraphQL queries on the code graph
3
+ */
4
+ export const GRAPHQL_TOOLS = [
5
+ {
6
+ name: 'query_graphql',
7
+ description: `Execute a GraphQL query on the code graph.
8
+
9
+ GraphQL provides typed, nested queries with pagination — complementary to Datalog.
10
+ Use GraphQL when you need nested data in one query (node + edges + neighbors).
11
+ Use Datalog (query_graph) for pattern matching and logical rules.
12
+
13
+ SCHEMA HIGHLIGHTS:
14
+ - node(id: ID!): Node — get a single node
15
+ - nodes(filter: {type, name, file, exported}, first, after): NodeConnection — paginated search
16
+ - bfs/dfs(startIds, maxDepth, edgeTypes): [ID!]! — graph traversal
17
+ - reachability(from, to, edgeTypes, maxDepth): Boolean — path existence
18
+ - datalog(query, limit, offset): DatalogResult — Datalog passthrough
19
+ - findCalls(target, className): [CallInfo!]! — call graph
20
+ - traceDataFlow(source, file, direction, maxDepth): [[String!]!]! — data flow
21
+ - stats: GraphStats — node/edge counts
22
+
23
+ Node fields: id, name, type, file, line, column, exported, metadata,
24
+ outgoingEdges(types), incomingEdges(types), children, parent
25
+
26
+ EXAMPLE:
27
+ query {
28
+ nodes(filter: {type: "FUNCTION", file: "src/api"}, first: 5) {
29
+ edges {
30
+ node {
31
+ name, file, line
32
+ outgoingEdges(types: ["CALLS"]) {
33
+ edges { node { dst { name, file } } }
34
+ }
35
+ }
36
+ }
37
+ totalCount
38
+ }
39
+ }
40
+
41
+ Use get_documentation(topic="graphql-schema") for the full schema.`,
42
+ inputSchema: {
43
+ type: 'object',
44
+ properties: {
45
+ query: {
46
+ type: 'string',
47
+ description: 'GraphQL query string',
48
+ },
49
+ variables: {
50
+ type: 'object',
51
+ description: 'Optional variables for the query (JSON object)',
52
+ },
53
+ operationName: {
54
+ type: 'string',
55
+ description: 'Optional operation name (when query contains multiple operations)',
56
+ },
57
+ },
58
+ required: ['query'],
59
+ },
60
+ },
61
+ ];
62
+ //# sourceMappingURL=graphql-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graphql-tools.js","sourceRoot":"","sources":["../../src/definitions/graphql-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,aAAa,GAAqB;IAC7C;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mEAkCkD;QAC/D,WAAW,EAAE;YACX,IAAI,EAAE,QAAiB;YACvB,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,sBAAsB;iBACpC;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gDAAgD;iBAC9D;gBACD,aAAa,EAAE;oBACb,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,mEAAmE;iBACjF;aACF;YACD,QAAQ,EAAE,CAAC,OAAO,CAAC;SACpB;KACF;CACF,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Guarantee Tools — creating, checking, and managing code guarantees
3
+ */
4
+ import type { ToolDefinition } from './types.js';
5
+ export declare const GUARANTEE_TOOLS: ToolDefinition[];
6
+ //# sourceMappingURL=guarantee-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guarantee-tools.d.ts","sourceRoot":"","sources":["../../src/definitions/guarantee-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,eAAe,EAAE,cAAc,EAmI3C,CAAC"}
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Guarantee Tools — creating, checking, and managing code guarantees
3
+ */
4
+ export const GUARANTEE_TOOLS = [
5
+ {
6
+ name: 'create_guarantee',
7
+ description: `Create a new code guarantee.
8
+
9
+ Two types supported:
10
+ 1. Datalog-based: Uses rule field with Datalog query (violation/1)
11
+ 2. Contract-based: Uses type + schema for JSON validation
12
+
13
+ Examples:
14
+ - Datalog: name="no-eval" rule="violation(X) :- node(X, \"CALL\"), attr(X, \"name\", \"eval\")."
15
+ - Contract: name="orders" type="guarantee:queue" priority="critical" schema={...}`,
16
+ inputSchema: {
17
+ type: 'object',
18
+ properties: {
19
+ name: {
20
+ type: 'string',
21
+ description: 'Unique name for the guarantee',
22
+ },
23
+ // Datalog-based fields
24
+ rule: {
25
+ type: 'string',
26
+ description: 'Datalog rule defining violation/1 (for Datalog-based guarantees)',
27
+ },
28
+ severity: {
29
+ type: 'string',
30
+ description: 'Severity for Datalog guarantees: error, warning, or info',
31
+ enum: ['error', 'warning', 'info'],
32
+ },
33
+ // Contract-based fields
34
+ type: {
35
+ type: 'string',
36
+ description: 'Guarantee type for contract-based: guarantee:queue, guarantee:api, guarantee:permission',
37
+ enum: ['guarantee:queue', 'guarantee:api', 'guarantee:permission'],
38
+ },
39
+ priority: {
40
+ type: 'string',
41
+ description: 'Priority level: critical, important, observed, tracked',
42
+ enum: ['critical', 'important', 'observed', 'tracked'],
43
+ },
44
+ status: {
45
+ type: 'string',
46
+ description: 'Lifecycle status: discovered, reviewed, active, changing, deprecated',
47
+ enum: ['discovered', 'reviewed', 'active', 'changing', 'deprecated'],
48
+ },
49
+ owner: {
50
+ type: 'string',
51
+ description: 'Owner of the guarantee (team or person)',
52
+ },
53
+ schema: {
54
+ type: 'object',
55
+ description: 'JSON Schema for contract-based validation',
56
+ },
57
+ condition: {
58
+ type: 'string',
59
+ description: 'Condition expression for the guarantee',
60
+ },
61
+ description: {
62
+ type: 'string',
63
+ description: 'Human-readable description',
64
+ },
65
+ governs: {
66
+ type: 'array',
67
+ items: { type: 'string' },
68
+ description: 'Node IDs that this guarantee governs',
69
+ },
70
+ },
71
+ required: ['name'],
72
+ },
73
+ },
74
+ {
75
+ name: 'list_guarantees',
76
+ description: `List all defined code guarantees (rules and contracts).
77
+
78
+ Use this to:
79
+ - See existing invariants: "What rules does this codebase enforce?"
80
+ - Understand code contracts before modifying code
81
+ - Find Datalog-based rules (e.g., "no-eval", "no-sql-injection")
82
+ - List contract-based guarantees (queue schemas, API contracts)
83
+
84
+ Returns for each guarantee: name, type, description, rule/schema, priority, status.
85
+ Use BEFORE check_guarantees to see what will be validated.`,
86
+ inputSchema: {
87
+ type: 'object',
88
+ properties: {},
89
+ },
90
+ },
91
+ {
92
+ name: 'check_guarantees',
93
+ description: `Validate code against defined guarantees and return violations.
94
+
95
+ Use this to:
96
+ - Find violations: Run all rules, get list of breaking code
97
+ - Verify specific rule: check_guarantees(names=["no-eval"]) — test one guarantee
98
+ - Pre-commit validation: Catch issues before code review
99
+ - After code changes: Verify you didn't break existing rules
100
+
101
+ Returns: Violations array with node IDs, file, line, rule name.
102
+ Empty array = all guarantees pass.`,
103
+ inputSchema: {
104
+ type: 'object',
105
+ properties: {
106
+ names: {
107
+ type: 'array',
108
+ items: { type: 'string' },
109
+ description: 'List of guarantee names to check (omit to check all)',
110
+ },
111
+ },
112
+ },
113
+ },
114
+ {
115
+ name: 'delete_guarantee',
116
+ description: `Delete a guarantee by name.
117
+
118
+ Use this when:
119
+ - A guarantee is no longer relevant to the codebase
120
+ - Replacing a guarantee with a new version (delete old, create new)
121
+ - Cleaning up experimental guarantees after testing
122
+
123
+ This permanently removes the guarantee. Use list_guarantees first to verify the name.`,
124
+ inputSchema: {
125
+ type: 'object',
126
+ properties: {
127
+ name: {
128
+ type: 'string',
129
+ description: 'Name of guarantee to delete',
130
+ },
131
+ },
132
+ required: ['name'],
133
+ },
134
+ },
135
+ ];
136
+ //# sourceMappingURL=guarantee-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guarantee-tools.js","sourceRoot":"","sources":["../../src/definitions/guarantee-tools.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE;;;;;;;;kFAQiE;QAC9E,WAAW,EA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;oBACzB,WAAW,EAAE,sCAAsC;iBACpD;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;IACD;QACE,IAAI,EAAE,iBAAiB;QACvB,WAAW,EAAE;;;;;;;;;2DAS0C;QACvD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE;;;;;;;;;mCASkB;QAC/B,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,OAAO;oBACb,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;oBACzB,WAAW,EAAE,sDAAsD;iBACpE;aACF;SACF;KACF;IACD;QACE,IAAI,EAAE,kBAAkB;QACxB,WAAW,EAAE;;;;;;;sFAOqE;QAClF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,6BAA6B;iBAC3C;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;SACnB;KACF;CACF,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * MCP Tool Definitions — combined re-export
3
+ */
4
+ export type { ToolDefinition, SchemaProperty } from './types.js';
5
+ import type { ToolDefinition } from './types.js';
6
+ export declare const TOOLS: ToolDefinition[];
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/definitions/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAWjD,eAAO,MAAM,KAAK,EAAE,cAAc,EAUjC,CAAC"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * MCP Tool Definitions — combined re-export
3
+ */
4
+ import { QUERY_TOOLS } from './query-tools.js';
5
+ import { ANALYSIS_TOOLS } from './analysis-tools.js';
6
+ import { GUARANTEE_TOOLS } from './guarantee-tools.js';
7
+ import { CONTEXT_TOOLS } from './context-tools.js';
8
+ import { PROJECT_TOOLS } from './project-tools.js';
9
+ import { GRAPH_TOOLS } from './graph-tools.js';
10
+ import { KNOWLEDGE_TOOLS } from './knowledge-tools.js';
11
+ import { NOTATION_TOOLS } from './notation-tools.js';
12
+ import { GRAPHQL_TOOLS } from './graphql-tools.js';
13
+ export const TOOLS = [
14
+ ...QUERY_TOOLS,
15
+ ...ANALYSIS_TOOLS,
16
+ ...GUARANTEE_TOOLS,
17
+ ...CONTEXT_TOOLS,
18
+ ...PROJECT_TOOLS,
19
+ ...GRAPH_TOOLS,
20
+ ...KNOWLEDGE_TOOLS,
21
+ ...NOTATION_TOOLS,
22
+ ...GRAPHQL_TOOLS,
23
+ ];
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/definitions/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,CAAC,MAAM,KAAK,GAAqB;IACrC,GAAG,WAAW;IACd,GAAG,cAAc;IACjB,GAAG,eAAe;IAClB,GAAG,aAAa;IAChB,GAAG,aAAa;IAChB,GAAG,WAAW;IACd,GAAG,eAAe;IAClB,GAAG,cAAc;IACjB,GAAG,aAAa;CACjB,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Knowledge Tools — managing the persistent knowledge layer
3
+ *
4
+ * Knowledge nodes (decisions, facts, sessions) are stored as git-tracked
5
+ * markdown files with YAML frontmatter. These tools provide CRUD operations
6
+ * on the in-memory KnowledgeBase index.
7
+ */
8
+ import type { ToolDefinition } from './types.js';
9
+ export declare const KNOWLEDGE_TOOLS: ToolDefinition[];
10
+ //# sourceMappingURL=knowledge-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-tools.d.ts","sourceRoot":"","sources":["../../src/definitions/knowledge-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,eAAe,EAAE,cAAc,EAmS3C,CAAC"}
@@ -0,0 +1,300 @@
1
+ /**
2
+ * Knowledge Tools — managing the persistent knowledge layer
3
+ *
4
+ * Knowledge nodes (decisions, facts, sessions) are stored as git-tracked
5
+ * markdown files with YAML frontmatter. These tools provide CRUD operations
6
+ * on the in-memory KnowledgeBase index.
7
+ */
8
+ export const KNOWLEDGE_TOOLS = [
9
+ {
10
+ name: 'add_knowledge',
11
+ description: `Add a new knowledge node (decision, fact, session, etc.) to the knowledge base.
12
+
13
+ Use this when you:
14
+ - Make an architectural decision during a session → type: DECISION
15
+ - Discover a fact about the codebase → type: FACT
16
+ - Want to record a design session → type: SESSION
17
+ - Need to track a commit, ticket, incident, or author → type: COMMIT/TICKET/INCIDENT/AUTHOR
18
+
19
+ The node is persisted as a markdown file in the knowledge/ directory and tracked by git.
20
+ ID format: kb:<type>:<slug> — generated from type + slug. Slug collision = error (likely a duplicate; use supersede_fact instead).
21
+
22
+ Example: add_knowledge(type="DECISION", content="Use file-based storage for KB", slug="kb-file-based-storage", status="active", projections=["epistemic"])`,
23
+ inputSchema: {
24
+ type: 'object',
25
+ properties: {
26
+ type: {
27
+ type: 'string',
28
+ description: 'Node type',
29
+ enum: ['DECISION', 'FACT', 'SESSION', 'COMMIT', 'FILE_CHANGE', 'AUTHOR', 'TICKET', 'INCIDENT'],
30
+ },
31
+ content: {
32
+ type: 'string',
33
+ description: 'Markdown body content for the knowledge node',
34
+ },
35
+ slug: {
36
+ type: 'string',
37
+ description: 'URL-safe slug for the ID (auto-generated from content if omitted). Format: lowercase, hyphens, digits.',
38
+ },
39
+ subtype: {
40
+ type: 'string',
41
+ description: 'Subtype within the node type. FACT: domain, error, preference. DECISION: adr, runbook. Extensible — not restricted to these values.',
42
+ },
43
+ scope: {
44
+ type: 'string',
45
+ description: 'Scope of applicability for this knowledge node',
46
+ enum: ['global', 'project', 'module'],
47
+ },
48
+ relates_to: {
49
+ type: 'array',
50
+ items: { type: 'string' },
51
+ description: 'Semantic IDs of related nodes. Creates edges in edges.yaml.',
52
+ },
53
+ projections: {
54
+ type: 'array',
55
+ items: { type: 'string' },
56
+ description: 'Projections this node belongs to (e.g., "epistemic", "temporal", "organizational")',
57
+ },
58
+ status: {
59
+ type: 'string',
60
+ description: 'Decision status (only for DECISION type)',
61
+ enum: ['active', 'superseded', 'deprecated', 'proposed'],
62
+ },
63
+ confidence: {
64
+ type: 'string',
65
+ description: 'Confidence level (only for FACT type)',
66
+ enum: ['high', 'medium', 'low'],
67
+ },
68
+ effective_from: {
69
+ type: 'string',
70
+ description: 'Date when decision took effect (YYYY-MM-DD, only for DECISION)',
71
+ },
72
+ applies_to: {
73
+ type: 'array',
74
+ items: { type: 'string' },
75
+ description: 'Semantic addresses of code this applies to (only for DECISION)',
76
+ },
77
+ task_id: {
78
+ type: 'string',
79
+ description: 'Associated Linear task ID (only for SESSION)',
80
+ },
81
+ },
82
+ required: ['type', 'content'],
83
+ },
84
+ },
85
+ {
86
+ name: 'query_knowledge',
87
+ description: `Query knowledge nodes with filters.
88
+
89
+ Use this to:
90
+ - Find all decisions: query_knowledge(type="DECISION")
91
+ - Search by keyword: query_knowledge(text="RFDB")
92
+ - Find nodes in a projection: query_knowledge(projection="epistemic")
93
+ - Find related nodes: query_knowledge(relates_to="kb:session:2026-03-06-design")
94
+ - Combine filters: query_knowledge(type="FACT", text="auth")
95
+ - Find facts about code that no longer exists: query_knowledge(include_dangling_only=true)
96
+
97
+ Returns matching nodes with their full content, metadata, and code reference resolution status.
98
+ Code references (relates_to, applies_to) are resolved against the current code graph — each ref shows [OK] or [DANGLING] status.`,
99
+ inputSchema: {
100
+ type: 'object',
101
+ properties: {
102
+ type: {
103
+ type: 'string',
104
+ description: 'Filter by node type',
105
+ enum: ['DECISION', 'FACT', 'SESSION', 'COMMIT', 'FILE_CHANGE', 'AUTHOR', 'TICKET', 'INCIDENT'],
106
+ },
107
+ projection: {
108
+ type: 'string',
109
+ description: 'Filter by projection (e.g., "epistemic", "temporal")',
110
+ },
111
+ relates_to: {
112
+ type: 'string',
113
+ description: 'Filter by relates_to containing this semantic ID',
114
+ },
115
+ text: {
116
+ type: 'string',
117
+ description: 'Case-insensitive text search in body content',
118
+ },
119
+ include_dangling_only: {
120
+ type: 'boolean',
121
+ description: 'When true, return only nodes with code references that no longer resolve (dangling). Requires code graph to be analyzed.',
122
+ },
123
+ },
124
+ },
125
+ },
126
+ {
127
+ name: 'query_decisions',
128
+ description: `Query architectural decisions, optionally filtered by module or status.
129
+
130
+ Use this to:
131
+ - Find decisions affecting a module: query_decisions(module="packages/cli:CLI:MODULE")
132
+ - Find all active decisions: query_decisions(status="active")
133
+ - Find all decisions: query_decisions()
134
+
135
+ Returns decisions with status, applies_to, and full content.
136
+ Decisions are the core artifact type — they record WHY code is the way it is.`,
137
+ inputSchema: {
138
+ type: 'object',
139
+ properties: {
140
+ module: {
141
+ type: 'string',
142
+ description: 'Semantic address to match against applies_to (string includes matching)',
143
+ },
144
+ status: {
145
+ type: 'string',
146
+ description: 'Filter by decision status',
147
+ enum: ['active', 'superseded', 'deprecated', 'proposed'],
148
+ },
149
+ },
150
+ },
151
+ },
152
+ {
153
+ name: 'supersede_fact',
154
+ description: `Supersede an existing fact with a new version.
155
+
156
+ Use this when:
157
+ - A fact becomes outdated (e.g., library was upgraded, architecture changed)
158
+ - You discover new information that replaces an existing fact
159
+ - Correcting a previously recorded fact
160
+
161
+ This creates a NEW fact and marks the OLD fact with superseded_by pointing to the new one.
162
+ The old fact remains in the knowledge base for history.
163
+
164
+ Example: supersede_fact(old_id="kb:fact:auth-uses-bcrypt", new_content="Auth now uses argon2 after migration in REG-500")`,
165
+ inputSchema: {
166
+ type: 'object',
167
+ properties: {
168
+ old_id: {
169
+ type: 'string',
170
+ description: 'Semantic ID of the fact to supersede (e.g., "kb:fact:auth-uses-bcrypt")',
171
+ },
172
+ new_content: {
173
+ type: 'string',
174
+ description: 'Markdown content for the new fact',
175
+ },
176
+ new_slug: {
177
+ type: 'string',
178
+ description: 'Optional slug for the new fact (auto-generated if omitted)',
179
+ },
180
+ },
181
+ required: ['old_id', 'new_content'],
182
+ },
183
+ },
184
+ {
185
+ name: 'get_knowledge_stats',
186
+ description: `Get statistics about the knowledge base.
187
+
188
+ Use this to:
189
+ - Check if knowledge base is loaded and has content
190
+ - See counts by node type (DECISION, FACT, SESSION, etc.)
191
+ - See counts by lifecycle (declared, derived, synced)
192
+ - Identify dangling references in edges
193
+ - See dangling code references (KB nodes pointing at code that no longer exists in the graph)
194
+
195
+ Returns: total nodes, by-type counts, by-lifecycle counts, edge counts, dangling KB refs, dangling code refs.
196
+ Code reference resolution requires the code graph to be analyzed — without it, danglingCodeRefs will be empty.`,
197
+ inputSchema: {
198
+ type: 'object',
199
+ properties: {},
200
+ },
201
+ },
202
+ // Disabled: requires git-ingest (US-17). See US-17 in AI-AGENT-STORIES.md
203
+ // {
204
+ // name: 'git_churn',
205
+ // description: `Identify hot spots — files ranked by change frequency.
206
+ //
207
+ // Use this to:
208
+ // - Find which files change most often (high churn = high risk or high activity)
209
+ // - Prioritize code review effort based on change frequency
210
+ // - Identify files that may need refactoring (too many changes = unstable)
211
+ //
212
+ // Returns files sorted by change count, with total lines added/removed.
213
+ // Requires git history to be ingested first (grafema git-ingest).`,
214
+ // inputSchema: {
215
+ // type: 'object',
216
+ // properties: {
217
+ // limit: {
218
+ // type: 'number',
219
+ // description: 'Maximum number of results (default: 20)',
220
+ // },
221
+ // since: {
222
+ // type: 'string',
223
+ // description: 'Only count changes after this date (ISO format, e.g., "2025-01-01")',
224
+ // },
225
+ // },
226
+ // },
227
+ // },
228
+ // {
229
+ // name: 'git_cochange',
230
+ // description: `Find files that frequently change together with a given file.
231
+ //
232
+ // Use this to:
233
+ // - Discover hidden coupling between files (change A → usually change B too)
234
+ // - Understand the blast radius of modifying a file
235
+ // - Identify candidates for refactoring into a single module
236
+ //
237
+ // Returns files ranked by co-change frequency, with support metric (0-1).
238
+ // Requires git history to be ingested first (grafema git-ingest).`,
239
+ // inputSchema: {
240
+ // type: 'object',
241
+ // properties: {
242
+ // file: {
243
+ // type: 'string',
244
+ // description: 'File path to find co-changes for',
245
+ // },
246
+ // min_support: {
247
+ // type: 'number',
248
+ // description: 'Minimum support threshold (0-1, default: 0.1 = 10% of commits)',
249
+ // },
250
+ // },
251
+ // required: ['file'],
252
+ // },
253
+ // },
254
+ // {
255
+ // name: 'git_ownership',
256
+ // description: `Find who knows a file best — authors ranked by contribution.
257
+ //
258
+ // Use this to:
259
+ // - Identify domain experts for a specific file or module
260
+ // - Find the right person to review changes to a file
261
+ // - Understand team ownership distribution
262
+ //
263
+ // Returns authors sorted by commit count, with lines added/removed.
264
+ // Requires git history to be ingested first (grafema git-ingest).`,
265
+ // inputSchema: {
266
+ // type: 'object',
267
+ // properties: {
268
+ // file: {
269
+ // type: 'string',
270
+ // description: 'File path to check ownership for',
271
+ // },
272
+ // },
273
+ // required: ['file'],
274
+ // },
275
+ // },
276
+ // {
277
+ // name: 'git_archaeology',
278
+ // description: `Get temporal context for a file — when it was first created and last modified.
279
+ //
280
+ // Use this to:
281
+ // - Find when a file was last touched (and by whom)
282
+ // - Discover the original author of a file
283
+ // - Assess staleness (old files may need review)
284
+ // - Understand the timeline of a module's evolution
285
+ //
286
+ // Returns first/last commit date, hash, and author.
287
+ // Requires git history to be ingested first (grafema git-ingest).`,
288
+ // inputSchema: {
289
+ // type: 'object',
290
+ // properties: {
291
+ // file: {
292
+ // type: 'string',
293
+ // description: 'File path to investigate',
294
+ // },
295
+ // },
296
+ // required: ['file'],
297
+ // },
298
+ // },
299
+ ];
300
+ //# sourceMappingURL=knowledge-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge-tools.js","sourceRoot":"","sources":["../../src/definitions/knowledge-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,CAAC,MAAM,eAAe,GAAqB;IAC/C;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE;;;;;;;;;;;2JAW0I;QACvJ,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,WAAW;oBACxB,IAAI,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC;iBAC/F;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8CAA8C;iBAC5D;gBACD,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wGAAwG;iBACtH;gBACD,OAAO,EAAE;oBACP,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qIAAqI;iBACnJ;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,gDAAgD;oBAC7D,IA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oDAAoD;IACpD,oEAAoE;IACpE,mBAAmB;IACnB,sBAAsB;IACtB,oBAAoB;IACpB,gBAAgB;IAChB,0BAA0B;IAC1B,mDAAmD;IACnD,WAAW;IACX,SAAS;IACT,0BAA0B;IAC1B,OAAO;IACP,KAAK;CACN,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Notation Tools — describe tool definition
3
+ *
4
+ * The `describe` tool renders a node's neighborhood as compact DSL notation,
5
+ * replacing verbose edge listings with archetype-grouped visual operators.
6
+ */
7
+ import type { ToolDefinition } from './types.js';
8
+ export declare const NOTATION_TOOLS: ToolDefinition[];
9
+ //# sourceMappingURL=notation-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notation-tools.d.ts","sourceRoot":"","sources":["../../src/definitions/notation-tools.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,eAAO,MAAM,cAAc,EAAE,cAAc,EAsD1C,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Notation Tools — describe tool definition
3
+ *
4
+ * The `describe` tool renders a node's neighborhood as compact DSL notation,
5
+ * replacing verbose edge listings with archetype-grouped visual operators.
6
+ */
7
+ export const NOTATION_TOOLS = [
8
+ {
9
+ name: 'describe',
10
+ description: `Render a node's neighborhood as compact Grafema DSL notation.
11
+
12
+ Reduces verbose edge listings to archetype-grouped visual operators:
13
+ o- dependency/import
14
+ > outward flow (calls, delegates, passes)
15
+ < inward flow (reads, extends, receives)
16
+ => persistent write (db, file, redis)
17
+ >x exception (throws, rejects)
18
+ ~>> event/message (emits, publishes)
19
+ ?| conditional guard (if, case)
20
+ |= governance (governs, monitors)
21
+
22
+ Containment edges ({ }) define nesting structure.
23
+
24
+ Example output:
25
+ login {
26
+ o- imports bcrypt
27
+ > calls UserDB.findByEmail, createToken
28
+ < reads config.auth
29
+ => writes session
30
+ >x throws AuthError
31
+ ~>> emits 'auth:login'
32
+ }
33
+
34
+ Use depth to control detail:
35
+ 0 = names only (children listed, no edges)
36
+ 1 = edges (default — shows all relationship lines)
37
+ 2 = nested + folded (compressed view — repetitive siblings collapsed)
38
+ 3 = nested (exact — every node expanded, no folding)
39
+
40
+ 10-30 lines vs 500+ lines of raw edge data. Ideal for LLM context windows.`,
41
+ inputSchema: {
42
+ type: 'object',
43
+ properties: {
44
+ target: {
45
+ type: 'string',
46
+ description: 'Semantic ID, file path, or node name to describe',
47
+ },
48
+ depth: {
49
+ type: 'number',
50
+ description: 'Level of detail: 0=names, 1=edges (default), 2=nested+folded (compressed), 3=nested (exact, no folding)',
51
+ },
52
+ perspective: {
53
+ type: 'string',
54
+ description: 'Archetype filter preset: "security" (write,exception), "data" (flow_out,flow_in,write), "errors" (exception), "api" (flow_out,publishes,depends), "events" (publishes)',
55
+ enum: ['security', 'data', 'errors', 'api', 'events'],
56
+ },
57
+ },
58
+ required: ['target'],
59
+ },
60
+ },
61
+ ];
62
+ //# sourceMappingURL=notation-tools.js.map