@kawacode/mcp 5.2.0 → 6.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 (81) hide show
  1. package/CLAUDE.md.example +1 -1
  2. package/README.md +54 -198
  3. package/build/index.js +10 -1
  4. package/build/index.js.map +1 -1
  5. package/build/kawacode-on-pre-edit.d.ts +27 -0
  6. package/build/kawacode-on-pre-edit.js +205 -0
  7. package/build/kawacode-on-pre-edit.js.map +1 -0
  8. package/build/kawacode-on-stop.d.ts +29 -0
  9. package/build/kawacode-on-stop.js +84 -0
  10. package/build/kawacode-on-stop.js.map +1 -0
  11. package/build/prompts/intent-first-workflow.js +2 -2
  12. package/build/services/muninn-ipc.d.ts +10 -5
  13. package/build/services/muninn-ipc.js +13 -8
  14. package/build/services/muninn-ipc.js.map +1 -1
  15. package/build/tools/_fork-fields.d.ts +84 -0
  16. package/build/tools/_fork-fields.js +65 -0
  17. package/build/tools/_fork-fields.js.map +1 -0
  18. package/build/tools/activate-intent.d.ts +66 -0
  19. package/build/tools/activate-intent.js +59 -3
  20. package/build/tools/activate-intent.js.map +1 -1
  21. package/build/tools/check-active-intent.d.ts +64 -0
  22. package/build/tools/check-active-intent.js +16 -2
  23. package/build/tools/check-active-intent.js.map +1 -1
  24. package/build/tools/complete-intent.d.ts +115 -4
  25. package/build/tools/complete-intent.js +130 -11
  26. package/build/tools/complete-intent.js.map +1 -1
  27. package/build/tools/create-intent.d.ts +73 -1
  28. package/build/tools/create-intent.js +105 -7
  29. package/build/tools/create-intent.js.map +1 -1
  30. package/build/tools/detect-intent-conflicts.d.ts +52 -0
  31. package/build/tools/detect-intent-conflicts.js +14 -10
  32. package/build/tools/detect-intent-conflicts.js.map +1 -1
  33. package/build/tools/edit-session-decision.d.ts +64 -12
  34. package/build/tools/edit-session-decision.js +4 -1
  35. package/build/tools/edit-session-decision.js.map +1 -1
  36. package/build/tools/evolve-decisions.d.ts +52 -0
  37. package/build/tools/evolve-decisions.js +14 -15
  38. package/build/tools/evolve-decisions.js.map +1 -1
  39. package/build/tools/get-intent-changes.d.ts +52 -0
  40. package/build/tools/get-intent-changes.js +4 -1
  41. package/build/tools/get-intent-changes.js.map +1 -1
  42. package/build/tools/get-intents-for-file.d.ts +52 -0
  43. package/build/tools/get-intents-for-file.js +4 -1
  44. package/build/tools/get-intents-for-file.js.map +1 -1
  45. package/build/tools/get-intents-for-lines.d.ts +52 -0
  46. package/build/tools/get-intents-for-lines.js +4 -1
  47. package/build/tools/get-intents-for-lines.js.map +1 -1
  48. package/build/tools/get-project-decisions.d.ts +52 -0
  49. package/build/tools/get-project-decisions.js +4 -1
  50. package/build/tools/get-project-decisions.js.map +1 -1
  51. package/build/tools/get-relevant-context.d.ts +52 -0
  52. package/build/tools/get-relevant-context.js +18 -24
  53. package/build/tools/get-relevant-context.js.map +1 -1
  54. package/build/tools/get-session-decisions.d.ts +52 -0
  55. package/build/tools/get-session-decisions.js +4 -1
  56. package/build/tools/get-session-decisions.js.map +1 -1
  57. package/build/tools/index.d.ts +620 -18
  58. package/build/tools/index.js +12 -3
  59. package/build/tools/index.js.map +1 -1
  60. package/build/tools/infer-history.d.ts +6 -0
  61. package/build/tools/infer-history.js +33 -16
  62. package/build/tools/infer-history.js.map +1 -1
  63. package/build/tools/list-team-intents.d.ts +58 -6
  64. package/build/tools/list-team-intents.js +5 -2
  65. package/build/tools/list-team-intents.js.map +1 -1
  66. package/build/tools/log-work.d.ts +52 -0
  67. package/build/tools/log-work.js +4 -1
  68. package/build/tools/log-work.js.map +1 -1
  69. package/build/tools/pre-edit-acknowledge.d.ts +92 -0
  70. package/build/tools/pre-edit-acknowledge.js +48 -0
  71. package/build/tools/pre-edit-acknowledge.js.map +1 -0
  72. package/build/tools/pre-edit-decision-check.d.ts +141 -0
  73. package/build/tools/pre-edit-decision-check.js +77 -0
  74. package/build/tools/pre-edit-decision-check.js.map +1 -0
  75. package/build/tools/record-decision.d.ts +88 -12
  76. package/build/tools/record-decision.js +15 -1
  77. package/build/tools/record-decision.js.map +1 -1
  78. package/build/tools/update-intent.d.ts +60 -8
  79. package/build/tools/update-intent.js +6 -1
  80. package/build/tools/update-intent.js.map +1 -1
  81. package/package.json +6 -3
@@ -0,0 +1,141 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Thin proxy to Muninn's `pre-edit-check:evaluate` handler.
4
+ *
5
+ * The entire evaluator + supersedes + telemetry + 4-way data fan-out used
6
+ * to live in this file (~280 LOC pre-thinning). Phase 2 of the kawa.mcp →
7
+ * kawa.muninn migration moved all that logic into Muninn's
8
+ * `services/pre_edit_check/` module. This tool's only remaining job is
9
+ * Zod-schema validation, origin resolution, and forwarding the request.
10
+ */
11
+ export declare const preEditDecisionCheckSchema: z.ZodObject<{
12
+ forkAuthor: z.ZodOptional<z.ZodObject<{
13
+ platform: z.ZodEnum<["github", "gitlab"]>;
14
+ user: z.ZodString;
15
+ forkOrigin: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ platform: "github" | "gitlab";
18
+ user: string;
19
+ forkOrigin: string;
20
+ }, {
21
+ platform: "github" | "gitlab";
22
+ user: string;
23
+ forkOrigin: string;
24
+ }>>;
25
+ workspaceId: z.ZodOptional<z.ZodString>;
26
+ repoOrigin: z.ZodOptional<z.ZodString>;
27
+ repoPath: z.ZodString;
28
+ filePath: z.ZodString;
29
+ startLine: z.ZodNumber;
30
+ endLine: z.ZodNumber;
31
+ intentId: z.ZodOptional<z.ZodString>;
32
+ sessionToken: z.ZodOptional<z.ZodString>;
33
+ }, "strip", z.ZodTypeAny, {
34
+ repoPath: string;
35
+ filePath: string;
36
+ startLine: number;
37
+ endLine: number;
38
+ repoOrigin?: string | undefined;
39
+ forkAuthor?: {
40
+ platform: "github" | "gitlab";
41
+ user: string;
42
+ forkOrigin: string;
43
+ } | undefined;
44
+ workspaceId?: string | undefined;
45
+ intentId?: string | undefined;
46
+ sessionToken?: string | undefined;
47
+ }, {
48
+ repoPath: string;
49
+ filePath: string;
50
+ startLine: number;
51
+ endLine: number;
52
+ repoOrigin?: string | undefined;
53
+ forkAuthor?: {
54
+ platform: "github" | "gitlab";
55
+ user: string;
56
+ forkOrigin: string;
57
+ } | undefined;
58
+ workspaceId?: string | undefined;
59
+ intentId?: string | undefined;
60
+ sessionToken?: string | undefined;
61
+ }>;
62
+ export type PreEditDecisionCheckInput = z.infer<typeof preEditDecisionCheckSchema>;
63
+ export interface EnclosingSymbol {
64
+ name: string;
65
+ fullyQualifiedName: string;
66
+ kind: string;
67
+ startLine: number;
68
+ endLine: number;
69
+ signature: string;
70
+ }
71
+ export interface PreEditDecisionCheckResponse {
72
+ triggered: boolean;
73
+ tier: '1a' | '1b' | null;
74
+ intents?: any[];
75
+ decisions?: any[];
76
+ filtered: {
77
+ activeIntentSupersedes: string[];
78
+ repoScopedSupersedes: string[];
79
+ sessionForceOverrides: string[];
80
+ };
81
+ recommendation: 'proceed' | 'review' | 'investigate-upstream';
82
+ enclosingSymbol: EnclosingSymbol | null;
83
+ language?: string;
84
+ }
85
+ export declare function preEditDecisionCheck(input: PreEditDecisionCheckInput): Promise<PreEditDecisionCheckResponse>;
86
+ export declare const preEditDecisionCheckTool: {
87
+ name: string;
88
+ description: string;
89
+ inputSchema: z.ZodObject<{
90
+ forkAuthor: z.ZodOptional<z.ZodObject<{
91
+ platform: z.ZodEnum<["github", "gitlab"]>;
92
+ user: z.ZodString;
93
+ forkOrigin: z.ZodString;
94
+ }, "strip", z.ZodTypeAny, {
95
+ platform: "github" | "gitlab";
96
+ user: string;
97
+ forkOrigin: string;
98
+ }, {
99
+ platform: "github" | "gitlab";
100
+ user: string;
101
+ forkOrigin: string;
102
+ }>>;
103
+ workspaceId: z.ZodOptional<z.ZodString>;
104
+ repoOrigin: z.ZodOptional<z.ZodString>;
105
+ repoPath: z.ZodString;
106
+ filePath: z.ZodString;
107
+ startLine: z.ZodNumber;
108
+ endLine: z.ZodNumber;
109
+ intentId: z.ZodOptional<z.ZodString>;
110
+ sessionToken: z.ZodOptional<z.ZodString>;
111
+ }, "strip", z.ZodTypeAny, {
112
+ repoPath: string;
113
+ filePath: string;
114
+ startLine: number;
115
+ endLine: number;
116
+ repoOrigin?: string | undefined;
117
+ forkAuthor?: {
118
+ platform: "github" | "gitlab";
119
+ user: string;
120
+ forkOrigin: string;
121
+ } | undefined;
122
+ workspaceId?: string | undefined;
123
+ intentId?: string | undefined;
124
+ sessionToken?: string | undefined;
125
+ }, {
126
+ repoPath: string;
127
+ filePath: string;
128
+ startLine: number;
129
+ endLine: number;
130
+ repoOrigin?: string | undefined;
131
+ forkAuthor?: {
132
+ platform: "github" | "gitlab";
133
+ user: string;
134
+ forkOrigin: string;
135
+ } | undefined;
136
+ workspaceId?: string | undefined;
137
+ intentId?: string | undefined;
138
+ sessionToken?: string | undefined;
139
+ }>;
140
+ handler: typeof preEditDecisionCheck;
141
+ };
@@ -0,0 +1,77 @@
1
+ import { z } from 'zod';
2
+ import { request } from '../services/muninn-ipc.js';
3
+ import { resolveOrigin } from './resolve-origin.js';
4
+ import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
5
+ /**
6
+ * Thin proxy to Muninn's `pre-edit-check:evaluate` handler.
7
+ *
8
+ * The entire evaluator + supersedes + telemetry + 4-way data fan-out used
9
+ * to live in this file (~280 LOC pre-thinning). Phase 2 of the kawa.mcp →
10
+ * kawa.muninn migration moved all that logic into Muninn's
11
+ * `services/pre_edit_check/` module. This tool's only remaining job is
12
+ * Zod-schema validation, origin resolution, and forwarding the request.
13
+ */
14
+ export const preEditDecisionCheckSchema = z.object({
15
+ repoOrigin: z
16
+ .string()
17
+ .optional()
18
+ .describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
19
+ repoPath: z
20
+ .string()
21
+ .describe('Local path to the repository root (also used to read the file for AST symbol detection)'),
22
+ filePath: z
23
+ .string()
24
+ .describe('Path to the file being edited (relative to repoPath)'),
25
+ startLine: z
26
+ .number()
27
+ .min(1)
28
+ .describe('Start line of the touched range (1-based, inclusive)'),
29
+ endLine: z
30
+ .number()
31
+ .min(1)
32
+ .describe('End line of the touched range (1-based, inclusive)'),
33
+ intentId: z
34
+ .string()
35
+ .optional()
36
+ .describe('Active intent ID for supersedes scoping. Auto-detected by Muninn when omitted.'),
37
+ sessionToken: z
38
+ .string()
39
+ .optional()
40
+ .describe('Session scope for the force-override cache. Defaults to the MCP server\'s SESSION_ID; PreToolUse hook callers should pass Claude Code\'s session_id so writes from one process are visible to the other.'),
41
+ ...forkFieldsExtensions,
42
+ });
43
+ export async function preEditDecisionCheck(input) {
44
+ const repoOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
45
+ const forkFields = extractForkFields(input);
46
+ const res = await request('pre-edit-check', 'evaluate', {
47
+ repoOrigin,
48
+ repoPath: input.repoPath,
49
+ filePath: input.filePath,
50
+ startLine: input.startLine,
51
+ endLine: input.endLine,
52
+ intentId: input.intentId,
53
+ sessionToken: input.sessionToken,
54
+ ...forkFields,
55
+ });
56
+ return res;
57
+ }
58
+ export const preEditDecisionCheckTool = {
59
+ name: 'pre_edit_decision_check',
60
+ description: `Check whether the line range about to be edited has prior recorded reasoning attached.
61
+
62
+ Call this BEFORE editing code in a kawa-indexed repo. Surfaces:
63
+ - Tier 1a — overlapping intents whose blocks cover these lines (line-precise team coordination + intent-scoped decisions)
64
+ - Tier 1b — repo decisions whose relatedFiles include this file (file-coarse, catches infer_history-extracted constraints)
65
+
66
+ Decisions already overridden via record_decision(supersedes=...) are filtered out automatically.
67
+
68
+ Recommendation maps to action:
69
+ - "proceed" — nothing relevant; safe to edit
70
+ - "review" — surfaced context worth inspecting before editing
71
+ - "investigate-upstream" — prior constraint or abandoned approach matches; don't proceed without reading the rationale and either revising the change or recording a new fork decision that supersedes the old one
72
+
73
+ Also returns the smallest enclosing function/method symbol via tree-sitter (Rust/TS/JS/Python only; null for other languages) for warning readability.`,
74
+ inputSchema: preEditDecisionCheckSchema,
75
+ handler: preEditDecisionCheck,
76
+ };
77
+ //# sourceMappingURL=pre-edit-decision-check.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pre-edit-decision-check.js","sourceRoot":"","sources":["../../src/tools/pre-edit-decision-check.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;AACnD,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE3E;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,MAAM,CAAC;IACjD,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,6EAA6E,CAAC;IAC1F,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,yFAAyF,CAAC;IACtG,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,CAAC,sDAAsD,CAAC;IACnE,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,sDAAsD,CAAC;IACnE,OAAO,EAAE,CAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,oDAAoD,CAAC;IACjE,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,gFAAgF,CAAC;IAC7F,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,0MAA0M,CAAC;IACvN,GAAG,oBAAoB;CACxB,CAAC,CAAA;AA4BF,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,KAAgC;IAEhC,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAA;IAClE,MAAM,UAAU,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAA;IAE3C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,gBAAgB,EAAE,UAAU,EAAE;QACtD,UAAU;QACV,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,SAAS,EAAE,KAAK,CAAC,SAAS;QAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,YAAY,EAAE,KAAK,CAAC,YAAY;QAChC,GAAG,UAAU;KACd,CAAC,CAAA;IAEF,OAAO,GAAmC,CAAA;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EAAE;;;;;;;;;;;;;uJAawI;IACrJ,WAAW,EAAE,0BAA0B;IACvC,OAAO,EAAE,oBAAoB;CAC9B,CAAA"}
@@ -1,5 +1,19 @@
1
1
  import { z } from 'zod';
2
2
  export declare const recordDecisionSchema: z.ZodObject<{
3
+ forkAuthor: z.ZodOptional<z.ZodObject<{
4
+ platform: z.ZodEnum<["github", "gitlab"]>;
5
+ user: z.ZodString;
6
+ forkOrigin: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ platform: "github" | "gitlab";
9
+ user: string;
10
+ forkOrigin: string;
11
+ }, {
12
+ platform: "github" | "gitlab";
13
+ user: string;
14
+ forkOrigin: string;
15
+ }>>;
16
+ workspaceId: z.ZodOptional<z.ZodString>;
3
17
  repoOrigin: z.ZodOptional<z.ZodString>;
4
18
  repoPath: z.ZodString;
5
19
  intentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -11,56 +25,80 @@ export declare const recordDecisionSchema: z.ZodObject<{
11
25
  consequences: z.ZodOptional<z.ZodString>;
12
26
  symptom: z.ZodOptional<z.ZodString>;
13
27
  relatedFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
28
+ supersedes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
14
29
  constraintsChecked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
30
  constraintViolations: z.ZodOptional<z.ZodArray<z.ZodObject<{
16
31
  alternative: z.ZodString;
17
32
  constraint: z.ZodString;
18
33
  reason: z.ZodString;
19
34
  }, "strip", z.ZodTypeAny, {
35
+ reason: string;
20
36
  alternative: string;
21
37
  constraint: string;
22
- reason: string;
23
38
  }, {
39
+ reason: string;
24
40
  alternative: string;
25
41
  constraint: string;
26
- reason: string;
27
42
  }>, "many">>;
43
+ source: z.ZodDefault<z.ZodOptional<z.ZodEnum<["user", "agent", "extractor", "infer_history"]>>>;
44
+ confidence: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
45
+ sourceThoughtIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
28
46
  }, "strip", z.ZodTypeAny, {
29
- repoPath: string;
30
47
  type: "abandoned" | "constraint" | "fork" | "discovery" | "tradeoff" | "dependency";
48
+ repoPath: string;
31
49
  summary: string;
32
50
  intentId: string;
33
51
  rationale: string;
52
+ source: "user" | "agent" | "extractor" | "infer_history";
34
53
  repoOrigin?: string | undefined;
54
+ forkAuthor?: {
55
+ platform: "github" | "gitlab";
56
+ user: string;
57
+ forkOrigin: string;
58
+ } | undefined;
59
+ workspaceId?: string | undefined;
35
60
  context?: string | undefined;
36
61
  alternatives?: string[] | undefined;
37
62
  consequences?: string | undefined;
38
63
  symptom?: string | undefined;
39
64
  relatedFiles?: string[] | undefined;
65
+ supersedes?: string[] | undefined;
40
66
  constraintsChecked?: string[] | undefined;
41
67
  constraintViolations?: {
68
+ reason: string;
42
69
  alternative: string;
43
70
  constraint: string;
44
- reason: string;
45
71
  }[] | undefined;
72
+ confidence?: "high" | "medium" | "low" | undefined;
73
+ sourceThoughtIds?: string[] | undefined;
46
74
  }, {
47
- repoPath: string;
48
75
  type: "abandoned" | "constraint" | "fork" | "discovery" | "tradeoff" | "dependency";
76
+ repoPath: string;
49
77
  summary: string;
50
78
  rationale: string;
51
79
  repoOrigin?: string | undefined;
80
+ forkAuthor?: {
81
+ platform: "github" | "gitlab";
82
+ user: string;
83
+ forkOrigin: string;
84
+ } | undefined;
85
+ workspaceId?: string | undefined;
52
86
  context?: string | undefined;
53
87
  intentId?: string | undefined;
54
88
  alternatives?: string[] | undefined;
55
89
  consequences?: string | undefined;
56
90
  symptom?: string | undefined;
57
91
  relatedFiles?: string[] | undefined;
92
+ supersedes?: string[] | undefined;
58
93
  constraintsChecked?: string[] | undefined;
59
94
  constraintViolations?: {
95
+ reason: string;
60
96
  alternative: string;
61
97
  constraint: string;
62
- reason: string;
63
98
  }[] | undefined;
99
+ source?: "user" | "agent" | "extractor" | "infer_history" | undefined;
100
+ confidence?: "high" | "medium" | "low" | undefined;
101
+ sourceThoughtIds?: string[] | undefined;
64
102
  }>;
65
103
  export type RecordDecisionInput = z.infer<typeof recordDecisionSchema>;
66
104
  export interface RecordDecisionResponse {
@@ -72,6 +110,20 @@ export declare const recordDecisionTool: {
72
110
  name: string;
73
111
  description: string;
74
112
  inputSchema: z.ZodObject<{
113
+ forkAuthor: z.ZodOptional<z.ZodObject<{
114
+ platform: z.ZodEnum<["github", "gitlab"]>;
115
+ user: z.ZodString;
116
+ forkOrigin: z.ZodString;
117
+ }, "strip", z.ZodTypeAny, {
118
+ platform: "github" | "gitlab";
119
+ user: string;
120
+ forkOrigin: string;
121
+ }, {
122
+ platform: "github" | "gitlab";
123
+ user: string;
124
+ forkOrigin: string;
125
+ }>>;
126
+ workspaceId: z.ZodOptional<z.ZodString>;
75
127
  repoOrigin: z.ZodOptional<z.ZodString>;
76
128
  repoPath: z.ZodString;
77
129
  intentId: z.ZodDefault<z.ZodOptional<z.ZodString>>;
@@ -83,56 +135,80 @@ export declare const recordDecisionTool: {
83
135
  consequences: z.ZodOptional<z.ZodString>;
84
136
  symptom: z.ZodOptional<z.ZodString>;
85
137
  relatedFiles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
138
+ supersedes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
86
139
  constraintsChecked: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
87
140
  constraintViolations: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
141
  alternative: z.ZodString;
89
142
  constraint: z.ZodString;
90
143
  reason: z.ZodString;
91
144
  }, "strip", z.ZodTypeAny, {
145
+ reason: string;
92
146
  alternative: string;
93
147
  constraint: string;
94
- reason: string;
95
148
  }, {
149
+ reason: string;
96
150
  alternative: string;
97
151
  constraint: string;
98
- reason: string;
99
152
  }>, "many">>;
153
+ source: z.ZodDefault<z.ZodOptional<z.ZodEnum<["user", "agent", "extractor", "infer_history"]>>>;
154
+ confidence: z.ZodOptional<z.ZodEnum<["high", "medium", "low"]>>;
155
+ sourceThoughtIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
100
156
  }, "strip", z.ZodTypeAny, {
101
- repoPath: string;
102
157
  type: "abandoned" | "constraint" | "fork" | "discovery" | "tradeoff" | "dependency";
158
+ repoPath: string;
103
159
  summary: string;
104
160
  intentId: string;
105
161
  rationale: string;
162
+ source: "user" | "agent" | "extractor" | "infer_history";
106
163
  repoOrigin?: string | undefined;
164
+ forkAuthor?: {
165
+ platform: "github" | "gitlab";
166
+ user: string;
167
+ forkOrigin: string;
168
+ } | undefined;
169
+ workspaceId?: string | undefined;
107
170
  context?: string | undefined;
108
171
  alternatives?: string[] | undefined;
109
172
  consequences?: string | undefined;
110
173
  symptom?: string | undefined;
111
174
  relatedFiles?: string[] | undefined;
175
+ supersedes?: string[] | undefined;
112
176
  constraintsChecked?: string[] | undefined;
113
177
  constraintViolations?: {
178
+ reason: string;
114
179
  alternative: string;
115
180
  constraint: string;
116
- reason: string;
117
181
  }[] | undefined;
182
+ confidence?: "high" | "medium" | "low" | undefined;
183
+ sourceThoughtIds?: string[] | undefined;
118
184
  }, {
119
- repoPath: string;
120
185
  type: "abandoned" | "constraint" | "fork" | "discovery" | "tradeoff" | "dependency";
186
+ repoPath: string;
121
187
  summary: string;
122
188
  rationale: string;
123
189
  repoOrigin?: string | undefined;
190
+ forkAuthor?: {
191
+ platform: "github" | "gitlab";
192
+ user: string;
193
+ forkOrigin: string;
194
+ } | undefined;
195
+ workspaceId?: string | undefined;
124
196
  context?: string | undefined;
125
197
  intentId?: string | undefined;
126
198
  alternatives?: string[] | undefined;
127
199
  consequences?: string | undefined;
128
200
  symptom?: string | undefined;
129
201
  relatedFiles?: string[] | undefined;
202
+ supersedes?: string[] | undefined;
130
203
  constraintsChecked?: string[] | undefined;
131
204
  constraintViolations?: {
205
+ reason: string;
132
206
  alternative: string;
133
207
  constraint: string;
134
- reason: string;
135
208
  }[] | undefined;
209
+ source?: "user" | "agent" | "extractor" | "infer_history" | undefined;
210
+ confidence?: "high" | "medium" | "low" | undefined;
211
+ sourceThoughtIds?: string[] | undefined;
136
212
  }>;
137
213
  handler: typeof recordDecision;
138
214
  };
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { request } from '../services/muninn-ipc.js';
3
3
  import { resolveOrigin } from './resolve-origin.js';
4
+ import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
4
5
  const constraintViolationSchema = z.object({
5
6
  alternative: z.string().describe('The alternative that was rejected'),
6
7
  constraint: z.string().describe('The constraint ID that was violated (e.g., "zero-knowledge")'),
@@ -19,9 +20,17 @@ export const recordDecisionSchema = z.object({
19
20
  consequences: z.string().optional().describe('Downstream implications of this decision'),
20
21
  symptom: z.string().optional().describe('Observable symptom that indicates this decision is relevant (e.g., error messages, runtime panics, unexpected behavior). Useful for discovery and constraint decisions.'),
21
22
  relatedFiles: z.array(z.string()).optional().describe('File paths affected by this decision'),
23
+ supersedes: z.array(z.string()).optional().describe('Decision IDs that this one replaces. When a later decision supersedes an earlier one, pass the earlier decisionId(s) here so the evolve pipeline can track the lineage.'),
22
24
  constraintsChecked: z.array(z.string()).optional().describe('Which architectural constraints were verified before this decision'),
23
25
  constraintViolations: z.array(constraintViolationSchema).optional()
24
- .describe('Alternatives that were rejected due to constraint violations')
26
+ .describe('Alternatives that were rejected due to constraint violations'),
27
+ source: z.enum(['user', 'agent', 'extractor', 'infer_history']).optional().default('agent')
28
+ .describe('Provenance: user (human-recorded), agent (AI deliberately recorded via this tool — the default), extractor (from thought-chain extraction), infer_history (from commit-history extraction). Most callers leave this as the default.'),
29
+ confidence: z.enum(['high', 'medium', 'low']).optional()
30
+ .describe('Self-rated confidence in the decision. Meaningful only for extractor and infer_history sources — leave null for deliberate recordings.'),
31
+ sourceThoughtIds: z.array(z.string()).optional()
32
+ .describe('Thought-chain entry IDs this record was extracted from. Only set by the extractor path.'),
33
+ ...forkFieldsExtensions,
25
34
  });
26
35
  export async function recordDecision(input) {
27
36
  const origin = resolveOrigin(input.repoOrigin, input.repoPath);
@@ -36,8 +45,13 @@ export async function recordDecision(input) {
36
45
  consequences: input.consequences,
37
46
  symptom: input.symptom,
38
47
  relatedFiles: input.relatedFiles || [],
48
+ supersedes: input.supersedes || [],
39
49
  constraintsChecked: input.constraintsChecked || [],
40
50
  constraintViolations: input.constraintViolations || [],
51
+ source: input.source,
52
+ confidence: input.confidence,
53
+ sourceThoughtIds: input.sourceThoughtIds || [],
54
+ ...extractForkFields(input),
41
55
  });
42
56
  return {
43
57
  recorded: res.success !== false,
@@ -1 +1 @@
1
- {"version":3,"file":"record-decision.js","sourceRoot":"","sources":["../../src/tools/record-decision.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,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;IACrE,UAAU,EAAE,C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BAAgB,EAAE,KAAK,CAAC,gBAAgB,IAAI,EAAE;QAC9C,GAAG,iBAAiB,CAAC,KAAK,CAAC;KAC5B,CAAC,CAAA;IAEF,OAAO;QACL,QAAQ,EAAE,GAAG,CAAC,OAAO,KAAK,KAAK;QAC/B,UAAU,EAAE,GAAG,CAAC,UAAU,IAAI,EAAE;KACjC,CAAA;AACH,CAAC;AAED,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE;;;;;;;;;;;;;;;yGAe0F;IACvG,WAAW,EAAE,oBAAoB;IACjC,OAAO,EAAE,cAAc;CACxB,CAAA"}
@@ -1,5 +1,19 @@
1
1
  import { z } from 'zod';
2
2
  export declare const updateIntentSchema: z.ZodObject<{
3
+ forkAuthor: z.ZodOptional<z.ZodObject<{
4
+ platform: z.ZodEnum<["github", "gitlab"]>;
5
+ user: z.ZodString;
6
+ forkOrigin: z.ZodString;
7
+ }, "strip", z.ZodTypeAny, {
8
+ platform: "github" | "gitlab";
9
+ user: string;
10
+ forkOrigin: string;
11
+ }, {
12
+ platform: "github" | "gitlab";
13
+ user: string;
14
+ forkOrigin: string;
15
+ }>>;
16
+ workspaceId: z.ZodOptional<z.ZodString>;
3
17
  repoOrigin: z.ZodOptional<z.ZodString>;
4
18
  repoPath: z.ZodString;
5
19
  intentId: z.ZodOptional<z.ZodString>;
@@ -10,32 +24,44 @@ export declare const updateIntentSchema: z.ZodObject<{
10
24
  type: z.ZodEnum<["repo", "folder", "files"]>;
11
25
  paths: z.ZodArray<z.ZodString, "many">;
12
26
  }, "strip", z.ZodTypeAny, {
13
- type: "repo" | "files" | "folder";
27
+ type: "repo" | "folder" | "files";
14
28
  paths: string[];
15
29
  }, {
16
- type: "repo" | "files" | "folder";
30
+ type: "repo" | "folder" | "files";
17
31
  paths: string[];
18
32
  }>>;
19
33
  }, "strip", z.ZodTypeAny, {
20
34
  repoPath: string;
21
35
  repoOrigin?: string | undefined;
36
+ forkAuthor?: {
37
+ platform: "github" | "gitlab";
38
+ user: string;
39
+ forkOrigin: string;
40
+ } | undefined;
41
+ workspaceId?: string | undefined;
22
42
  title?: string | undefined;
23
43
  description?: string | undefined;
24
44
  constraints?: string[] | undefined;
25
45
  intentId?: string | undefined;
26
46
  scope?: {
27
- type: "repo" | "files" | "folder";
47
+ type: "repo" | "folder" | "files";
28
48
  paths: string[];
29
49
  } | undefined;
30
50
  }, {
31
51
  repoPath: string;
32
52
  repoOrigin?: string | undefined;
53
+ forkAuthor?: {
54
+ platform: "github" | "gitlab";
55
+ user: string;
56
+ forkOrigin: string;
57
+ } | undefined;
58
+ workspaceId?: string | undefined;
33
59
  title?: string | undefined;
34
60
  description?: string | undefined;
35
61
  constraints?: string[] | undefined;
36
62
  intentId?: string | undefined;
37
63
  scope?: {
38
- type: "repo" | "files" | "folder";
64
+ type: "repo" | "folder" | "files";
39
65
  paths: string[];
40
66
  } | undefined;
41
67
  }>;
@@ -52,6 +78,20 @@ export declare const updateIntentTool: {
52
78
  name: string;
53
79
  description: string;
54
80
  inputSchema: z.ZodObject<{
81
+ forkAuthor: z.ZodOptional<z.ZodObject<{
82
+ platform: z.ZodEnum<["github", "gitlab"]>;
83
+ user: z.ZodString;
84
+ forkOrigin: z.ZodString;
85
+ }, "strip", z.ZodTypeAny, {
86
+ platform: "github" | "gitlab";
87
+ user: string;
88
+ forkOrigin: string;
89
+ }, {
90
+ platform: "github" | "gitlab";
91
+ user: string;
92
+ forkOrigin: string;
93
+ }>>;
94
+ workspaceId: z.ZodOptional<z.ZodString>;
55
95
  repoOrigin: z.ZodOptional<z.ZodString>;
56
96
  repoPath: z.ZodString;
57
97
  intentId: z.ZodOptional<z.ZodString>;
@@ -62,32 +102,44 @@ export declare const updateIntentTool: {
62
102
  type: z.ZodEnum<["repo", "folder", "files"]>;
63
103
  paths: z.ZodArray<z.ZodString, "many">;
64
104
  }, "strip", z.ZodTypeAny, {
65
- type: "repo" | "files" | "folder";
105
+ type: "repo" | "folder" | "files";
66
106
  paths: string[];
67
107
  }, {
68
- type: "repo" | "files" | "folder";
108
+ type: "repo" | "folder" | "files";
69
109
  paths: string[];
70
110
  }>>;
71
111
  }, "strip", z.ZodTypeAny, {
72
112
  repoPath: string;
73
113
  repoOrigin?: string | undefined;
114
+ forkAuthor?: {
115
+ platform: "github" | "gitlab";
116
+ user: string;
117
+ forkOrigin: string;
118
+ } | undefined;
119
+ workspaceId?: string | undefined;
74
120
  title?: string | undefined;
75
121
  description?: string | undefined;
76
122
  constraints?: string[] | undefined;
77
123
  intentId?: string | undefined;
78
124
  scope?: {
79
- type: "repo" | "files" | "folder";
125
+ type: "repo" | "folder" | "files";
80
126
  paths: string[];
81
127
  } | undefined;
82
128
  }, {
83
129
  repoPath: string;
84
130
  repoOrigin?: string | undefined;
131
+ forkAuthor?: {
132
+ platform: "github" | "gitlab";
133
+ user: string;
134
+ forkOrigin: string;
135
+ } | undefined;
136
+ workspaceId?: string | undefined;
85
137
  title?: string | undefined;
86
138
  description?: string | undefined;
87
139
  constraints?: string[] | undefined;
88
140
  intentId?: string | undefined;
89
141
  scope?: {
90
- type: "repo" | "files" | "folder";
142
+ type: "repo" | "folder" | "files";
91
143
  paths: string[];
92
144
  } | undefined;
93
145
  }>;
@@ -1,6 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { request } from '../services/muninn-ipc.js';
3
3
  import { resolveOrigin } from './resolve-origin.js';
4
+ import { forkFieldsExtensions, extractForkFields } from './_fork-fields.js';
4
5
  export const updateIntentSchema = z.object({
5
6
  repoOrigin: z.string().optional().describe('Git remote origin URL. Auto-detected from repoPath via git if not provided.'),
6
7
  repoPath: z.string().describe('Local path to the repository root'),
@@ -12,13 +13,15 @@ export const updateIntentSchema = z.object({
12
13
  type: z.enum(['repo', 'folder', 'files']),
13
14
  paths: z.array(z.string())
14
15
  }).optional().describe('Updated scope for the intent'),
16
+ ...forkFieldsExtensions,
15
17
  });
16
18
  export async function updateIntent(input) {
17
19
  const actualOrigin = resolveOrigin(input.repoOrigin, input.repoPath);
20
+ const forkFields = extractForkFields(input);
18
21
  // Resolve the intent ID: use provided intentId, or look up the active intent
19
22
  let intentId = input.intentId;
20
23
  if (!intentId) {
21
- const activeRes = await request('intent', 'get-active', { repoOrigin: actualOrigin });
24
+ const activeRes = await request('intent', 'get-active', { repoOrigin: actualOrigin, ...forkFields });
22
25
  intentId = activeRes.intentId || activeRes.intent?.id || '';
23
26
  if (!intentId) {
24
27
  return {
@@ -58,7 +61,9 @@ export async function updateIntent(input) {
58
61
  }
59
62
  const res = await request('intent', 'update', {
60
63
  id: intentId,
64
+ repoOrigin: actualOrigin,
61
65
  updates,
66
+ ...forkFields,
62
67
  });
63
68
  if (res.success === false) {
64
69
  return {