@kawacode/mcp 5.0.0

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 (88) hide show
  1. package/CLAUDE.md.example +80 -0
  2. package/LICENSE +35 -0
  3. package/README.md +322 -0
  4. package/build/index.d.ts +2 -0
  5. package/build/index.js +231 -0
  6. package/build/index.js.map +1 -0
  7. package/build/prompts/intent-first-workflow.d.ts +24 -0
  8. package/build/prompts/intent-first-workflow.js +204 -0
  9. package/build/prompts/intent-first-workflow.js.map +1 -0
  10. package/build/resources/active-intent.d.ts +9 -0
  11. package/build/resources/active-intent.js +52 -0
  12. package/build/resources/active-intent.js.map +1 -0
  13. package/build/services/active-intent-store.d.ts +36 -0
  14. package/build/services/active-intent-store.js +45 -0
  15. package/build/services/active-intent-store.js.map +1 -0
  16. package/build/services/kawa-api.d.ts +131 -0
  17. package/build/services/kawa-api.js +239 -0
  18. package/build/services/kawa-api.js.map +1 -0
  19. package/build/services/muninn-ipc.d.ts +45 -0
  20. package/build/services/muninn-ipc.js +275 -0
  21. package/build/services/muninn-ipc.js.map +1 -0
  22. package/build/services/repo-encryption.d.ts +46 -0
  23. package/build/services/repo-encryption.js +92 -0
  24. package/build/services/repo-encryption.js.map +1 -0
  25. package/build/services/storage-decryption.d.ts +52 -0
  26. package/build/services/storage-decryption.js +162 -0
  27. package/build/services/storage-decryption.js.map +1 -0
  28. package/build/tools/assign-blocks.d.ts +87 -0
  29. package/build/tools/assign-blocks.js +49 -0
  30. package/build/tools/assign-blocks.js.map +1 -0
  31. package/build/tools/check-active-intent.d.ts +50 -0
  32. package/build/tools/check-active-intent.js +48 -0
  33. package/build/tools/check-active-intent.js.map +1 -0
  34. package/build/tools/complete-intent.d.ts +48 -0
  35. package/build/tools/complete-intent.js +53 -0
  36. package/build/tools/complete-intent.js.map +1 -0
  37. package/build/tools/create-intent.d.ts +58 -0
  38. package/build/tools/create-intent.js +49 -0
  39. package/build/tools/create-intent.js.map +1 -0
  40. package/build/tools/detect-intent-conflicts.d.ts +361 -0
  41. package/build/tools/detect-intent-conflicts.js +91 -0
  42. package/build/tools/detect-intent-conflicts.js.map +1 -0
  43. package/build/tools/edit-session-decision.d.ts +201 -0
  44. package/build/tools/edit-session-decision.js +50 -0
  45. package/build/tools/edit-session-decision.js.map +1 -0
  46. package/build/tools/evolve-decisions.d.ts +50 -0
  47. package/build/tools/evolve-decisions.js +45 -0
  48. package/build/tools/evolve-decisions.js.map +1 -0
  49. package/build/tools/get-intent-changes.d.ts +49 -0
  50. package/build/tools/get-intent-changes.js +58 -0
  51. package/build/tools/get-intent-changes.js.map +1 -0
  52. package/build/tools/get-intents-for-file.d.ts +57 -0
  53. package/build/tools/get-intents-for-file.js +57 -0
  54. package/build/tools/get-intents-for-file.js.map +1 -0
  55. package/build/tools/get-intents-for-lines.d.ts +71 -0
  56. package/build/tools/get-intents-for-lines.js +64 -0
  57. package/build/tools/get-intents-for-lines.js.map +1 -0
  58. package/build/tools/get-project-context.d.ts +82 -0
  59. package/build/tools/get-project-context.js +73 -0
  60. package/build/tools/get-project-context.js.map +1 -0
  61. package/build/tools/get-project-decisions.d.ts +51 -0
  62. package/build/tools/get-project-decisions.js +56 -0
  63. package/build/tools/get-project-decisions.js.map +1 -0
  64. package/build/tools/get-relevant-context.d.ts +89 -0
  65. package/build/tools/get-relevant-context.js +104 -0
  66. package/build/tools/get-relevant-context.js.map +1 -0
  67. package/build/tools/get-session-decisions.d.ts +57 -0
  68. package/build/tools/get-session-decisions.js +48 -0
  69. package/build/tools/get-session-decisions.js.map +1 -0
  70. package/build/tools/index.d.ts +656 -0
  71. package/build/tools/index.js +57 -0
  72. package/build/tools/index.js.map +1 -0
  73. package/build/tools/infer-history.d.ts +85 -0
  74. package/build/tools/infer-history.js +69 -0
  75. package/build/tools/infer-history.js.map +1 -0
  76. package/build/tools/list-team-intents.d.ts +51 -0
  77. package/build/tools/list-team-intents.js +57 -0
  78. package/build/tools/list-team-intents.js.map +1 -0
  79. package/build/tools/log-work.d.ts +45 -0
  80. package/build/tools/log-work.js +30 -0
  81. package/build/tools/log-work.js.map +1 -0
  82. package/build/tools/record-decision.d.ts +132 -0
  83. package/build/tools/record-decision.js +66 -0
  84. package/build/tools/record-decision.js.map +1 -0
  85. package/build/tools/resolve-origin.d.ts +13 -0
  86. package/build/tools/resolve-origin.js +33 -0
  87. package/build/tools/resolve-origin.js.map +1 -0
  88. package/package.json +36 -0
@@ -0,0 +1,64 @@
1
+ import { z } from 'zod';
2
+ import { request } from '../services/muninn-ipc.js';
3
+ import { resolveOrigin } from './resolve-origin.js';
4
+ export const getIntentsForLinesSchema = z.object({
5
+ repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
6
+ repoPath: z.string().describe('Local path to the repository root'),
7
+ filePath: z.string().describe('Path to the file (relative to repo root)'),
8
+ startLine: z.number().min(1).describe('Start line number (1-based)'),
9
+ endLine: z.number().min(1).describe('End line number (1-based, inclusive)')
10
+ });
11
+ export async function getIntentsForLines(input) {
12
+ const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
13
+ const res = await request('intent-block', 'get-for-lines', {
14
+ repoOrigin: actualOrigin,
15
+ filePath: input.filePath,
16
+ startLine: input.startLine,
17
+ endLine: input.endLine,
18
+ });
19
+ const overlappingIntents = (res.intents || []).map((intent) => ({
20
+ intentId: intent.intent_id || intent.intentId || intent.id || '',
21
+ title: intent.title || 'Unknown Intent',
22
+ author: intent.author || intent.author_name || intent.authorName,
23
+ status: intent.status || 'active',
24
+ description: intent.description || '',
25
+ branch: intent.branch || '',
26
+ forkedFrom: intent.forked_from || intent.forkedFrom,
27
+ overlappingLines: {
28
+ blockStartLine: intent.block_start_line || intent.overlappingLines?.blockStartLine || 0,
29
+ blockEndLine: intent.block_end_line || intent.overlappingLines?.blockEndLine || 0,
30
+ overlapStart: intent.overlap_start || intent.overlappingLines?.overlapStart || 0,
31
+ overlapEnd: intent.overlap_end || intent.overlappingLines?.overlapEnd || 0,
32
+ }
33
+ }));
34
+ const hasOverlap = overlappingIntents.length > 0;
35
+ let warning;
36
+ if (hasOverlap) {
37
+ const activeIntents = overlappingIntents.filter(i => i.status === 'active');
38
+ if (activeIntents.length > 0) {
39
+ const authors = [...new Set(activeIntents.map(i => i.author).filter(Boolean))];
40
+ warning = `Lines ${input.startLine}-${input.endLine} overlap with active work by: ${authors.join(', ') || 'team members'}`;
41
+ }
42
+ }
43
+ return {
44
+ filePath: input.filePath,
45
+ queryRange: { startLine: input.startLine, endLine: input.endLine },
46
+ intents: overlappingIntents,
47
+ hasOverlap,
48
+ warning
49
+ };
50
+ }
51
+ export const getIntentsForLinesTool = {
52
+ name: 'get_intents_for_lines',
53
+ description: `Get intents covering a specific line range.
54
+
55
+ Use this before modifying specific lines to check for conflicts:
56
+ - Warns if the lines overlap with another team member's active intent
57
+ - Shows the exact overlap range
58
+ - Helps avoid merge conflicts and duplicate work
59
+
60
+ Returns overlap details so you can work around or coordinate with team members.`,
61
+ inputSchema: getIntentsForLinesSchema,
62
+ handler: getIntentsForLines
63
+ };
64
+ //# sourceMappingURL=get-intents-for-lines.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-intents-for-lines.js","sourceRoot":"","sources":["../../src/tools/get-intents-for-lines.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,E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,sBAAsB,GAAG;IACpC,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EAAE;;;;;;;gFAOiE;IAC9E,WAAW,EAAE,wBAAwB;IACrC,OAAO,EAAE,kBAAkB;CAC5B,CAAA"}
@@ -0,0 +1,82 @@
1
+ import { z } from 'zod';
2
+ export declare const getProjectContextSchema: z.ZodObject<{
3
+ repoOrigin: z.ZodString;
4
+ repoPath: z.ZodString;
5
+ maxDecisions: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
6
+ maxTeamIntents: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
7
+ includeTeamIntents: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
8
+ }, "strip", z.ZodTypeAny, {
9
+ repoOrigin: string;
10
+ repoPath: string;
11
+ maxDecisions: number;
12
+ maxTeamIntents: number;
13
+ includeTeamIntents: boolean;
14
+ }, {
15
+ repoOrigin: string;
16
+ repoPath: string;
17
+ maxDecisions?: number | undefined;
18
+ maxTeamIntents?: number | undefined;
19
+ includeTeamIntents?: boolean | undefined;
20
+ }>;
21
+ export type GetProjectContextInput = z.infer<typeof getProjectContextSchema>;
22
+ export interface ActiveIntent {
23
+ id: string;
24
+ title: string;
25
+ description: string;
26
+ templateType: string;
27
+ status: string;
28
+ branch: string;
29
+ }
30
+ export interface TeamIntent {
31
+ id: string;
32
+ title: string;
33
+ author: string;
34
+ status: string;
35
+ templateType: string;
36
+ }
37
+ export interface RecentDecision {
38
+ intentId: string;
39
+ type: string;
40
+ summary: string;
41
+ }
42
+ export interface GetProjectContextResponse {
43
+ projectOrigin: string;
44
+ projectPath: string;
45
+ activeIntent: ActiveIntent | null;
46
+ teamIntents: TeamIntent[];
47
+ teamIntentCount: number;
48
+ recentDecisions: RecentDecision[];
49
+ summary: {
50
+ hasActiveIntent: boolean;
51
+ activeIntentTitle: string | null;
52
+ teamMembersWorking: number;
53
+ teamIntentsShown: number;
54
+ teamIntentsTotal: number;
55
+ recentDecisionCount: number;
56
+ };
57
+ }
58
+ export declare function getProjectContext(input: GetProjectContextInput): Promise<GetProjectContextResponse>;
59
+ export declare const getProjectContextTool: {
60
+ name: string;
61
+ description: string;
62
+ inputSchema: z.ZodObject<{
63
+ repoOrigin: z.ZodString;
64
+ repoPath: z.ZodString;
65
+ maxDecisions: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
66
+ maxTeamIntents: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
67
+ includeTeamIntents: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
68
+ }, "strip", z.ZodTypeAny, {
69
+ repoOrigin: string;
70
+ repoPath: string;
71
+ maxDecisions: number;
72
+ maxTeamIntents: number;
73
+ includeTeamIntents: boolean;
74
+ }, {
75
+ repoOrigin: string;
76
+ repoPath: string;
77
+ maxDecisions?: number | undefined;
78
+ maxTeamIntents?: number | undefined;
79
+ includeTeamIntents?: boolean | undefined;
80
+ }>;
81
+ handler: typeof getProjectContext;
82
+ };
@@ -0,0 +1,73 @@
1
+ import { z } from 'zod';
2
+ import { request } from '../services/muninn-ipc.js';
3
+ import { resolveOrigin } from './resolve-origin.js';
4
+ export const getProjectContextSchema = z.object({
5
+ repoOrigin: z.string().describe('Git remote origin URL (e.g., git@github.com:user/repo.git)'),
6
+ repoPath: z.string().describe('Local path to the repository root'),
7
+ maxDecisions: z.number().optional().default(3).describe('Maximum number of recent decisions to return'),
8
+ maxTeamIntents: z.number().optional().default(5).describe('Maximum number of team intents to return'),
9
+ includeTeamIntents: z.boolean().optional().default(true).describe('Whether to include team intents')
10
+ });
11
+ export async function getProjectContext(input) {
12
+ const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
13
+ const res = await request('claude-code', 'project-context', {
14
+ repoOrigin: actualOrigin,
15
+ maxDecisions: input.maxDecisions,
16
+ maxTeamIntents: input.maxTeamIntents,
17
+ includeTeamIntents: input.includeTeamIntents,
18
+ });
19
+ // Transform Muninn response to MCP response format
20
+ const activeIntent = res.activeIntent
21
+ ? {
22
+ id: res.activeIntent.id || '',
23
+ title: res.activeIntent.title || '',
24
+ description: res.activeIntent.description || '',
25
+ templateType: res.activeIntent.templateType || 'feature',
26
+ status: res.activeIntent.status || 'active',
27
+ branch: res.activeIntent.branch || ''
28
+ }
29
+ : null;
30
+ const teamIntents = (res.teamIntents || []).map((i) => ({
31
+ id: i.id || '',
32
+ title: i.title || '',
33
+ author: i.author || i.authorName || 'Unknown',
34
+ status: i.status || 'active',
35
+ templateType: i.templateType || 'feature',
36
+ }));
37
+ const recentDecisions = (res.recentDecisions || []).map((d) => ({
38
+ intentId: d.intentId || '',
39
+ type: d.decisionType || d.type || '',
40
+ summary: d.summary || '',
41
+ }));
42
+ const uniqueAuthors = new Set(teamIntents.map(i => i.author));
43
+ return {
44
+ projectOrigin: actualOrigin,
45
+ projectPath: input.repoPath,
46
+ activeIntent,
47
+ teamIntents,
48
+ teamIntentCount: teamIntents.length,
49
+ recentDecisions,
50
+ summary: {
51
+ hasActiveIntent: activeIntent !== null,
52
+ activeIntentTitle: activeIntent?.title || null,
53
+ teamMembersWorking: uniqueAuthors.size,
54
+ teamIntentsShown: teamIntents.length,
55
+ teamIntentsTotal: res.teamIntentsTotal || teamIntents.length,
56
+ recentDecisionCount: recentDecisions.length
57
+ }
58
+ };
59
+ }
60
+ export const getProjectContextTool = {
61
+ name: 'get_project_context',
62
+ description: `Get project status overview before starting work. CALL THIS AT THE START OF EVERY CODING SESSION.
63
+
64
+ Returns a lightweight status check:
65
+ - **Active intent**: What you're currently working on (id, title, status)
66
+ - **Team intents**: What teammates are working on (titles only, see summary for total count)
67
+ - **Recent decisions**: Summary-only (type + one-liner) — use get_relevant_context for full rationale
68
+
69
+ This is a **status check**, not a knowledge dump. For task-specific context (full decision rationale, file-level conflicts), call get_relevant_context after exploring the user's request.`,
70
+ inputSchema: getProjectContextSchema,
71
+ handler: getProjectContext
72
+ };
73
+ //# sourceMappingURL=get-project-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-project-context.js","sourceRoot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AE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAA;IAE7D,OAAO;QACL,aAAa,EAAE,YAAY;QAC3B,WAAW,EAAE,KAAK,CAAC,QAAQ;QAC3B,YAAY;QACZ,WAAW;QACX,eAAe,EAAE,WAAW,CAAC,MAAM;QACnC,eAAe;QACf,OAAO,EAAE;YACP,eAAe,EAAE,YAAY,KAAK,IAAI;YACtC,iBAAiB,EAAE,YAAY,EAAE,KAAK,IAAI,IAAI;YAC9C,kBAAkB,EAAE,aAAa,CAAC,IAAI;YACtC,gBAAgB,EAAE,WAAW,CAAC,MAAM;YACpC,gBAAgB,EAAE,GAAG,CAAC,gBAAgB,IAAI,WAAW,CAAC,MAAM;YAC5D,mBAAmB,EAAE,eAAe,CAAC,MAAM;SAC5C;KACF,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE;;;;;;;2LAO4K;IACzL,WAAW,EAAE,uBAAuB;IACpC,OAAO,EAAE,iBAAiB;CAC3B,CAAA"}
@@ -0,0 +1,51 @@
1
+ import { z } from 'zod';
2
+ export declare const getProjectDecisionsSchema: z.ZodObject<{
3
+ repoOrigin: z.ZodOptional<z.ZodString>;
4
+ repoPath: z.ZodString;
5
+ }, "strip", z.ZodTypeAny, {
6
+ repoPath: string;
7
+ repoOrigin?: string | undefined;
8
+ }, {
9
+ repoPath: string;
10
+ repoOrigin?: string | undefined;
11
+ }>;
12
+ export type GetProjectDecisionsInput = z.infer<typeof getProjectDecisionsSchema>;
13
+ export interface ConstraintViolation {
14
+ alternative: string;
15
+ constraint: string;
16
+ reason: string;
17
+ }
18
+ export interface ProjectDecision {
19
+ intentId: string;
20
+ id: string;
21
+ timestamp: string;
22
+ type: 'fork' | 'abandoned' | 'discovery' | 'constraint' | 'tradeoff' | 'dependency';
23
+ summary: string;
24
+ rationale: string;
25
+ context?: string;
26
+ alternatives: string[];
27
+ consequences?: string;
28
+ relatedFiles: string[];
29
+ constraintsChecked: string[];
30
+ constraintViolations: ConstraintViolation[];
31
+ }
32
+ export interface GetProjectDecisionsResponse {
33
+ decisions: ProjectDecision[];
34
+ count: number;
35
+ }
36
+ export declare function getProjectDecisions(input: GetProjectDecisionsInput): Promise<GetProjectDecisionsResponse>;
37
+ export declare const getProjectDecisionsTool: {
38
+ name: string;
39
+ description: string;
40
+ inputSchema: z.ZodObject<{
41
+ repoOrigin: z.ZodOptional<z.ZodString>;
42
+ repoPath: z.ZodString;
43
+ }, "strip", z.ZodTypeAny, {
44
+ repoPath: string;
45
+ repoOrigin?: string | undefined;
46
+ }, {
47
+ repoPath: string;
48
+ repoOrigin?: string | undefined;
49
+ }>;
50
+ handler: typeof getProjectDecisions;
51
+ };
@@ -0,0 +1,56 @@
1
+ import { z } from 'zod';
2
+ import { request } from '../services/muninn-ipc.js';
3
+ import { resolveOrigin } from './resolve-origin.js';
4
+ export const getProjectDecisionsSchema = z.object({
5
+ repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
6
+ repoPath: z.string().describe('Local path to the repository root')
7
+ });
8
+ export async function getProjectDecisions(input) {
9
+ const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
10
+ const res = await request('decision', 'project-list', {
11
+ repoOrigin: actualOrigin,
12
+ });
13
+ const decisions = (res.decisions || []).map((d) => ({
14
+ intentId: d.intent_id || d.intentId || '',
15
+ id: d.decision_id || d.decisionId || d._id || d.id || '',
16
+ timestamp: d.timestamp || d.created_at || d.createdAt || '',
17
+ type: d.decision_type || d.decisionType || d.type,
18
+ summary: d.summary || '',
19
+ rationale: d.rationale || '',
20
+ context: d.context,
21
+ alternatives: d.alternatives || [],
22
+ consequences: d.consequences,
23
+ relatedFiles: d.related_files || d.relatedFiles || [],
24
+ constraintsChecked: d.constraints_checked || d.constraintsChecked || [],
25
+ constraintViolations: d.constraint_violations || d.constraintViolations || []
26
+ }));
27
+ return {
28
+ decisions,
29
+ count: decisions.length
30
+ };
31
+ }
32
+ export const getProjectDecisionsTool = {
33
+ name: 'get_project_decisions',
34
+ description: `Get all decisions recorded for a project across all intents.
35
+
36
+ Use this to review the project's decision history:
37
+ - See what architectural decisions have been made
38
+ - Understand past trade-offs and their rationale
39
+ - Find decisions affecting specific files
40
+ - Review constraint violations that were avoided
41
+
42
+ Returns:
43
+ - decisions: Array of decisions with their intent context
44
+ - count: Total number of decisions
45
+
46
+ Each decision includes:
47
+ - intentId: The intent this decision belongs to
48
+ - type: fork, abandoned, discovery, constraint, tradeoff, or dependency
49
+ - summary: Brief description of the decision
50
+ - rationale: Why this decision was made
51
+ - relatedFiles: Files affected by this decision
52
+ - constraintViolations: Options that were rejected due to constraints`,
53
+ inputSchema: getProjectDecisionsSchema,
54
+ handler: getProjectDecisions
55
+ };
56
+ //# sourceMappingURL=get-project-decisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-project-decisions.js","sourceRoot":"","sources":["../../src/tools/get-project-decisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;CACnE,CAAC,CAAA;AA8BF,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,KAA+B;IACvE,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IACpE,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,UAAU,E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,WAAW,EAAE,yBAAyB;IACtC,OAAO,EAAE,mBAAmB;CAC7B,CAAA"}
@@ -0,0 +1,89 @@
1
+ import { z } from 'zod';
2
+ export declare const getRelevantContextSchema: z.ZodObject<{
3
+ repoOrigin: z.ZodOptional<z.ZodString>;
4
+ repoPath: z.ZodString;
5
+ prompt: z.ZodString;
6
+ activeFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
7
+ maxIntents: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
8
+ maxDecisions: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
9
+ minRelevance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
10
+ }, "strip", z.ZodTypeAny, {
11
+ repoPath: string;
12
+ prompt: string;
13
+ maxIntents: number;
14
+ maxDecisions: number;
15
+ minRelevance: number;
16
+ repoOrigin?: string | undefined;
17
+ activeFiles?: string[] | undefined;
18
+ }, {
19
+ repoPath: string;
20
+ prompt: string;
21
+ repoOrigin?: string | undefined;
22
+ activeFiles?: string[] | undefined;
23
+ maxIntents?: number | undefined;
24
+ maxDecisions?: number | undefined;
25
+ minRelevance?: number | undefined;
26
+ }>;
27
+ export type GetRelevantContextInput = z.infer<typeof getRelevantContextSchema>;
28
+ export interface ScoredIntent {
29
+ id: string;
30
+ title: string;
31
+ description: string;
32
+ status: string;
33
+ templateType: string;
34
+ score: number;
35
+ }
36
+ export interface ScoredDecision {
37
+ id: string;
38
+ intentId: string;
39
+ type: string;
40
+ summary: string;
41
+ rationale: string;
42
+ relatedFiles: string[];
43
+ hasViolations: boolean;
44
+ score: number;
45
+ }
46
+ export interface GetRelevantContextResponse {
47
+ projectOrigin: string;
48
+ projectPath: string;
49
+ relevantIntents: ScoredIntent[];
50
+ relevantDecisions: ScoredDecision[];
51
+ summary: {
52
+ totalIntentsSearched: number;
53
+ totalDecisionsSearched: number;
54
+ intentsReturned: number;
55
+ decisionsReturned: number;
56
+ };
57
+ error?: string;
58
+ }
59
+ export declare function getRelevantContext(input: GetRelevantContextInput): Promise<GetRelevantContextResponse>;
60
+ export declare const getRelevantContextTool: {
61
+ name: string;
62
+ description: string;
63
+ inputSchema: z.ZodObject<{
64
+ repoOrigin: z.ZodOptional<z.ZodString>;
65
+ repoPath: z.ZodString;
66
+ prompt: z.ZodString;
67
+ activeFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
68
+ maxIntents: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
69
+ maxDecisions: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
70
+ minRelevance: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
71
+ }, "strip", z.ZodTypeAny, {
72
+ repoPath: string;
73
+ prompt: string;
74
+ maxIntents: number;
75
+ maxDecisions: number;
76
+ minRelevance: number;
77
+ repoOrigin?: string | undefined;
78
+ activeFiles?: string[] | undefined;
79
+ }, {
80
+ repoPath: string;
81
+ prompt: string;
82
+ repoOrigin?: string | undefined;
83
+ activeFiles?: string[] | undefined;
84
+ maxIntents?: number | undefined;
85
+ maxDecisions?: number | undefined;
86
+ minRelevance?: number | undefined;
87
+ }>;
88
+ handler: typeof getRelevantContext;
89
+ };
@@ -0,0 +1,104 @@
1
+ import { z } from 'zod';
2
+ import { request } from '../services/muninn-ipc.js';
3
+ import { resolveOrigin } from './resolve-origin.js';
4
+ export const getRelevantContextSchema = z.object({
5
+ repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
6
+ repoPath: z.string().describe('Local path to the repository root'),
7
+ prompt: z.string().describe('The user request to find relevant context for'),
8
+ activeFiles: z.array(z.string()).optional().describe('Files currently being discussed or recently opened'),
9
+ maxIntents: z.number().optional().default(10).describe('Maximum number of intents to return'),
10
+ maxDecisions: z.number().optional().default(10).describe('Maximum number of decisions to return'),
11
+ minRelevance: z.number().optional().default(0.3).describe('Minimum relevance score (0-1)')
12
+ });
13
+ const EMPTY_RESPONSE = (origin, path) => ({
14
+ projectOrigin: origin,
15
+ projectPath: path,
16
+ relevantIntents: [],
17
+ relevantDecisions: [],
18
+ summary: {
19
+ totalIntentsSearched: 0,
20
+ totalDecisionsSearched: 0,
21
+ intentsReturned: 0,
22
+ decisionsReturned: 0,
23
+ },
24
+ });
25
+ export async function getRelevantContext(input) {
26
+ const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
27
+ let res;
28
+ try {
29
+ res = await request('search', 'context', {
30
+ origin: actualOrigin,
31
+ query: input.prompt,
32
+ activeFiles: input.activeFiles || [],
33
+ maxIntents: input.maxIntents,
34
+ maxDecisions: input.maxDecisions,
35
+ minScore: input.minRelevance,
36
+ });
37
+ }
38
+ catch (err) {
39
+ const msg = err?.message || String(err);
40
+ return { ...EMPTY_RESPONSE(actualOrigin, input.repoPath), error: `Muninn unavailable: ${msg}` };
41
+ }
42
+ return {
43
+ projectOrigin: actualOrigin,
44
+ projectPath: input.repoPath,
45
+ relevantIntents: (res.intents || []).map((i) => ({
46
+ id: i._id || i.id || '',
47
+ title: i.title || '',
48
+ description: i.description || '',
49
+ status: i.status || 'active',
50
+ templateType: i.templateType || i.template_type || 'feature',
51
+ score: i.score || 0,
52
+ })),
53
+ relevantDecisions: (res.decisions || []).map((d) => ({
54
+ id: d.decisionId || d.decision_id || '',
55
+ intentId: d.intentId || d.intent_id || '',
56
+ type: d.decisionType || d.decision_type || d.type || '',
57
+ summary: d.summary || '',
58
+ rationale: d.rationale || '',
59
+ relatedFiles: d.relatedFiles || d.related_files || [],
60
+ hasViolations: (d.constraintViolations || d.constraint_violations || []).length > 0,
61
+ score: d.score || 0,
62
+ })),
63
+ summary: {
64
+ totalIntentsSearched: res.summary?.totalIntents || 0,
65
+ totalDecisionsSearched: res.summary?.totalDecisions || 0,
66
+ intentsReturned: (res.intents || []).length,
67
+ decisionsReturned: (res.decisions || []).length,
68
+ }
69
+ };
70
+ }
71
+ export const getRelevantContextTool = {
72
+ name: 'get_relevant_context',
73
+ description: `Find context relevant to a specific user request.
74
+
75
+ Use this when you need context that's specifically relevant to the current task,
76
+ rather than all recent context. This is more token-efficient for large projects.
77
+
78
+ **IMPORTANT: Call this AFTER initial exploration of the request**, not immediately.
79
+ Once you know which files are involved, pass them in \`activeFiles\` for much better
80
+ relevance matching. A vague prompt alone yields poor results.
81
+
82
+ The tool:
83
+ 1. Sends your prompt to the API for semantic embedding
84
+ 2. Computes cosine similarity against stored embeddings for all intents and decisions
85
+ 3. Uses \`activeFiles\` to boost items with matching file paths
86
+ 4. Returns only the most relevant items above the minimum score threshold
87
+
88
+ **Recommended workflow:**
89
+ 1. \`check_active_intent\` at SESSION START (resume existing work)
90
+ 2. Explore the user's request (read files, understand scope)
91
+ 3. \`get_relevant_context\` with prompt + activeFiles (task-specific context)
92
+
93
+ Returns:
94
+ - **relevantIntents**: Past work related to the current task
95
+ - **relevantDecisions**: Decisions affecting similar code/concepts (both intent-scoped and repo-scoped)
96
+
97
+ Example: User asks "Add validation to user registration endpoint"
98
+ After exploring, you found src/routes/user.ts and src/validators/
99
+ Call with: prompt + activeFiles: ["src/routes/user.ts", "src/validators/user.ts"]
100
+ Returns intents/decisions matching these files and keywords`,
101
+ inputSchema: getRelevantContextSchema,
102
+ handler: getRelevantContext
103
+ };
104
+ //# sourceMappingURL=get-relevant-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-relevant-context.js","sourceRoot":"","sources":["../../src/tools/get-relevant-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CA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AAC,SAAS,IAAI,EAAE;YACzC,IAAI,EAAE,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,IAAI,IAAI,EAAE;YACvD,OAAO,EAAE,CAAC,CAAC,OAAO,IAAI,EAAE;YACxB,SAAS,EAAE,CAAC,CAAC,SAAS,IAAI,EAAE;YAC5B,YAAY,EAAE,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,aAAa,IAAI,EAAE;YACrD,aAAa,EAAE,CAAC,CAAC,CAAC,oBAAoB,IAAI,CAAC,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC;YACnF,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;SACpB,CAAC,CAAC;QAEH,OAAO,EAAE;YACP,oBAAoB,EAAE,GAAG,CAAC,OAAO,EAAE,YAAY,IAAI,CAAC;YACpD,sBAAsB,EAAE,GAAG,CAAC,OAAO,EAAE,cAAc,IAAI,CAAC;YACxD,eAAe,EAAE,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,MAAM;YAC3C,iBAAiB,EAAE,CAAC,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,MAAM;SAChD;KACF,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;4DA2B6C;IAC1D,WAAW,EAAE,wBAAwB;IACrC,OAAO,EAAE,kBAAkB;CAC5B,CAAA"}
@@ -0,0 +1,57 @@
1
+ import { z } from 'zod';
2
+ export declare const getSessionDecisionsSchema: z.ZodObject<{
3
+ repoOrigin: z.ZodOptional<z.ZodString>;
4
+ repoPath: z.ZodString;
5
+ intentId: z.ZodString;
6
+ }, "strip", z.ZodTypeAny, {
7
+ repoPath: string;
8
+ intentId: string;
9
+ repoOrigin?: string | undefined;
10
+ }, {
11
+ repoPath: string;
12
+ intentId: string;
13
+ repoOrigin?: string | undefined;
14
+ }>;
15
+ export type GetSessionDecisionsInput = z.infer<typeof getSessionDecisionsSchema>;
16
+ export interface ConstraintViolation {
17
+ alternative: string;
18
+ constraint: string;
19
+ reason: string;
20
+ }
21
+ export interface DecisionPoint {
22
+ id: string;
23
+ timestamp: string;
24
+ type: 'fork' | 'abandoned' | 'discovery' | 'constraint' | 'tradeoff' | 'dependency';
25
+ summary: string;
26
+ rationale: string;
27
+ context?: string;
28
+ alternatives: string[];
29
+ consequences?: string;
30
+ relatedFiles: string[];
31
+ constraintsChecked: string[];
32
+ constraintViolations: ConstraintViolation[];
33
+ }
34
+ export interface GetSessionDecisionsResponse {
35
+ intentId: string;
36
+ decisions: DecisionPoint[];
37
+ count: number;
38
+ }
39
+ export declare function getSessionDecisions(input: GetSessionDecisionsInput): Promise<GetSessionDecisionsResponse>;
40
+ export declare const getSessionDecisionsTool: {
41
+ name: string;
42
+ description: string;
43
+ inputSchema: z.ZodObject<{
44
+ repoOrigin: z.ZodOptional<z.ZodString>;
45
+ repoPath: z.ZodString;
46
+ intentId: z.ZodString;
47
+ }, "strip", z.ZodTypeAny, {
48
+ repoPath: string;
49
+ intentId: string;
50
+ repoOrigin?: string | undefined;
51
+ }, {
52
+ repoPath: string;
53
+ intentId: string;
54
+ repoOrigin?: string | undefined;
55
+ }>;
56
+ handler: typeof getSessionDecisions;
57
+ };
@@ -0,0 +1,48 @@
1
+ import { z } from 'zod';
2
+ import { request } from '../services/muninn-ipc.js';
3
+ import { resolveOrigin } from './resolve-origin.js';
4
+ export const getSessionDecisionsSchema = z.object({
5
+ repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
6
+ repoPath: z.string().describe('Local path to the repository root'),
7
+ intentId: z.string().describe('The intent ID to get decisions for')
8
+ });
9
+ export async function getSessionDecisions(input) {
10
+ const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
11
+ const res = await request('decision', 'list', {
12
+ repoOrigin: actualOrigin,
13
+ intentId: input.intentId,
14
+ });
15
+ const decisions = (res.decisions || []).map((d) => ({
16
+ id: d.decision_id || d.decisionId || d._id || d.id || '',
17
+ timestamp: d.timestamp || d.created_at || d.createdAt || '',
18
+ type: d.decision_type || d.decisionType || d.type,
19
+ summary: d.summary || '',
20
+ rationale: d.rationale || '',
21
+ context: d.context,
22
+ alternatives: d.alternatives || [],
23
+ consequences: d.consequences,
24
+ relatedFiles: d.related_files || d.relatedFiles || [],
25
+ constraintsChecked: d.constraints_checked || d.constraintsChecked || [],
26
+ constraintViolations: d.constraint_violations || d.constraintViolations || []
27
+ }));
28
+ return {
29
+ intentId: input.intentId,
30
+ decisions,
31
+ count: decisions.length
32
+ };
33
+ }
34
+ export const getSessionDecisionsTool = {
35
+ name: 'get_session_decisions',
36
+ description: `Get all decisions recorded in the current session for an intent.
37
+
38
+ Use this before committing to review what decisions were captured during development.
39
+ Decisions are presented for user review and can be edited or removed before being persisted.
40
+
41
+ Returns:
42
+ - intentId: The intent these decisions belong to
43
+ - decisions: Array of decision points with full details
44
+ - count: Number of decisions recorded`,
45
+ inputSchema: getSessionDecisionsSchema,
46
+ handler: getSessionDecisions
47
+ };
48
+ //# sourceMappingURL=get-session-decisions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-session-decisions.js","sourceRoot":"","sources":["../../src/tools/get-session-decisions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEnD,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChD,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,6EAA6E,CAAC;IACzH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QA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