nimai-mcp 0.4.9 → 0.5.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.
@@ -0,0 +1,63 @@
1
+ # Spec: [title]
2
+
3
+ ## Deliverable
4
+ *What exists when this is done. Name the artifact, not the activity.*
5
+
6
+ - Artifact:
7
+ - Format:
8
+ - Quality bar (measurable — a number, a passing command, a checkable property):
9
+
10
+ ## Scope
11
+ **In scope:**
12
+ -
13
+
14
+ **Out of scope (will not be built — be explicit, this is what prevents drift):**
15
+ -
16
+
17
+ ## Task Decomposition
18
+ *Each sub-task completable in under 2 hours, with its own binary acceptance criteria. State dependencies between sub-tasks explicitly.*
19
+
20
+ | # | Sub-task | Depends on | Acceptance criteria | How it is checked |
21
+ |---|---|---|---|---|
22
+ | 1 | | — | | |
23
+
24
+ ## Mechanism Decisions
25
+ *One block per core choice. A builder must never have to pick an approach mid-build.*
26
+
27
+ **Decision: [short name]**
28
+ - Chosen: [exactly one approach]
29
+ - Rejected: [the alternatives considered]
30
+ - Why: [one sentence]
31
+
32
+ ## Architecture Lock
33
+ *Resolve every line. "TBD" and blanks mean the spec is not ready. Write "none" where a field genuinely does not apply, with a reason.*
34
+
35
+ - Persistence layer:
36
+ - File/object storage:
37
+ - External services + env vars:
38
+ - API/trigger flow:
39
+ - Entity states and transitions:
40
+ - Auth:
41
+
42
+ ## Change Surface
43
+ *Every existing file this work touches, classified. The builder may not touch anything outside this table.*
44
+ *Greenfield project? Replace the table with the single line: "Greenfield — no existing code to change."*
45
+
46
+ | Path | Verb (DELETE / REWRITE / EDIT / KEEP) | Why |
47
+ |---|---|---|
48
+ | | | |
49
+
50
+ ## Edge Cases and Failure Modes
51
+ *What will the builder hit mid-execution that the sections above do not answer? An empty list here is a red flag, not a green one.*
52
+
53
+ -
54
+ -
55
+
56
+ ## Spec Convergence
57
+ *Non-zero counts mean this spec is not ready. Fix the spec, not the numbers.*
58
+
59
+ open_questions: 0
60
+ ambiguities_remaining: 0
61
+ ready_for_build: yes
62
+
63
+ <!-- nimai-spec tier=full -->
@@ -0,0 +1,39 @@
1
+ # Spec: [title]
2
+
3
+ ## Deliverable
4
+ *What exists when this is done. Name the artifact, not the activity.*
5
+
6
+ - Artifact:
7
+ - Format:
8
+ - Quality bar (measurable — a number, a passing command, a checkable property):
9
+
10
+ ## Scope
11
+ **In scope:**
12
+ -
13
+
14
+ **Out of scope (will not be built — be explicit, this is what prevents drift):**
15
+ -
16
+
17
+ ## Acceptance Criteria
18
+ *Binary and checkable. Leave every box unchecked — they are checked by the reviewer, not the author.*
19
+
20
+ Done when ALL of these are true:
21
+ - [ ]
22
+ - [ ]
23
+
24
+ ## Mechanism Decisions
25
+ *One block per core choice. A builder must never have to pick an approach mid-build.*
26
+
27
+ **Decision: [short name]**
28
+ - Chosen: [exactly one approach]
29
+ - Rejected: [the alternatives considered]
30
+ - Why: [one sentence]
31
+
32
+ ## Spec Convergence
33
+ *Non-zero counts mean this spec is not ready. Fix the spec, not the numbers.*
34
+
35
+ open_questions: 0
36
+ ambiguities_remaining: 0
37
+ ready_for_build: yes
38
+
39
+ <!-- nimai-spec tier=lite -->
@@ -1,19 +1,19 @@
1
1
  /**
2
- * FORGE MCP Tool Contract — v1
2
+ * Nimai MCP Tool Contract — v2 (v0.5.0)
3
3
  *
4
+ * Exactly 3 tools: nimai_spec, nimai_validate, nimai_review.
4
5
  * All tool schemas are defined and locked here before server implementation.
5
6
  * Do NOT change tool names or output shapes without a contract version bump.
6
7
  *
7
- * Adversarial review notes (stress-tested before locking):
8
+ * Contract notes:
8
9
  * - Tool names prefixed with "nimai_" to avoid collisions with host tool namespaces
9
10
  * - All inputs validated with zod to prevent runtime shape errors
10
11
  * - Outputs are plain serialisable objects (no class instances, no Buffers)
11
- * - No LLM calls inside any tool — tools return context/structure only
12
+ * - No LLM calls inside any tool — tools return prompts/structure only
12
13
  * - specPath / repoPath are absolute or relative to cwd; server does NOT resolve ~
13
- * - outputPath for nimai_new: parent directory is created if missing; write errors surface as tool errors
14
14
  */
15
15
  import { z } from 'zod';
16
- import type { LintIssue, ContextItem } from 'nimai-core';
16
+ import type { LintIssue } from 'nimai-core';
17
17
  export declare const ForgeSpecInput: z.ZodObject<{
18
18
  repoPath: z.ZodString;
19
19
  request: z.ZodString;
@@ -24,13 +24,6 @@ export declare const ForgeSpecInput: z.ZodObject<{
24
24
  repoPath: string;
25
25
  request: string;
26
26
  }>;
27
- export declare const ForgeReviewInput: z.ZodObject<{
28
- specPath: z.ZodString;
29
- }, "strip", z.ZodTypeAny, {
30
- specPath: string;
31
- }, {
32
- specPath: string;
33
- }>;
34
27
  export declare const ForgeValidateInput: z.ZodObject<{
35
28
  specPath: z.ZodString;
36
29
  }, "strip", z.ZodTypeAny, {
@@ -38,65 +31,28 @@ export declare const ForgeValidateInput: z.ZodObject<{
38
31
  }, {
39
32
  specPath: string;
40
33
  }>;
41
- export declare const ForgeNewInput: z.ZodObject<{
42
- outputPath: z.ZodString;
43
- }, "strip", z.ZodTypeAny, {
44
- outputPath: string;
45
- }, {
46
- outputPath: string;
47
- }>;
48
- export declare const ForgeSpecReviewInput: z.ZodObject<{
34
+ export declare const ForgeReviewInput: z.ZodObject<{
49
35
  specPath: z.ZodString;
36
+ target: z.ZodEnum<["spec", "implementation"]>;
50
37
  }, "strip", z.ZodTypeAny, {
51
38
  specPath: string;
39
+ target: "spec" | "implementation";
52
40
  }, {
53
41
  specPath: string;
42
+ target: "spec" | "implementation";
54
43
  }>;
55
44
  export interface ForgeSpecOutput {
56
- /** The populated FORGE Prompt 1 (Self-Spec Agent), ready to pass to a model */
57
- prompt: string;
58
- /** Repo context items extracted for the request */
59
- context: ContextItem[];
60
- /**
61
- * Existing nimai-managed spec files found in the repo (sorted newest-first).
62
- * Empty array means no spec file exists yet — MUST call nimai_new immediately as the next action.
63
- * Do not ask follow-up questions or narrate alternatives before calling nimai_new.
64
- * Non-empty means spec files already exist — you may fill one of these instead of creating a new one.
65
- */
66
- existing_specs: string[];
67
- /**
68
- * Concrete follow-up questions when request ambiguity blocks reliable spec drafting.
69
- * Triggered when request is under 10 words OR zero repo files matched.
70
- * Optional — absent when no clarification is needed.
71
- */
72
- clarifications_needed?: string[];
73
- }
74
- export interface ForgeReviewOutput {
75
- /** The populated FORGE Prompt 2 (Reviewer/Validator), derived from the spec */
76
- reviewerPrompt: string;
45
+ /** The Nimai spec protocol prompt run this as the host model to draft the spec */
46
+ protocolPrompt: string;
77
47
  }
78
48
  export interface ForgeValidateOutput {
79
49
  issues: LintIssue[];
80
50
  /** true if zero hard (non-advisory) issues found */
81
51
  passed: boolean;
82
52
  }
83
- export interface ForgeNewOutput {
84
- /** Absolute path where the spec file was written */
85
- path: string;
86
- /** Content written to the file */
87
- content: string;
88
- }
89
- export interface ForgeSpecReviewOutput {
90
- /**
91
- * FORGE Prompt 1.5 — Spec-Quality Reviewer prompt.
92
- * Must be evaluated by an independent reviewer — NOT the agent that created the spec.
93
- */
94
- specReviewerPrompt: string;
95
- /**
96
- * Ready-to-display instructions for the user on how to complete the independent review.
97
- * The agent should present this to the user verbatim and wait for them to return the verdict.
98
- */
99
- reviewer_instructions: string;
53
+ export interface ForgeReviewOutput {
54
+ /** The reviewer prompt pass to an independent model/session */
55
+ reviewerPrompt: string;
100
56
  }
101
57
  export declare const TOOL_DESCRIPTORS: {
102
58
  readonly nimai_spec: {
@@ -113,17 +69,6 @@ export declare const TOOL_DESCRIPTORS: {
113
69
  request: string;
114
70
  }>;
115
71
  };
116
- readonly nimai_review: {
117
- readonly name: "nimai_review";
118
- readonly description: string;
119
- readonly inputSchema: z.ZodObject<{
120
- specPath: z.ZodString;
121
- }, "strip", z.ZodTypeAny, {
122
- specPath: string;
123
- }, {
124
- specPath: string;
125
- }>;
126
- };
127
72
  readonly nimai_validate: {
128
73
  readonly name: "nimai_validate";
129
74
  readonly description: string;
@@ -135,26 +80,18 @@ export declare const TOOL_DESCRIPTORS: {
135
80
  specPath: string;
136
81
  }>;
137
82
  };
138
- readonly nimai_new: {
139
- readonly name: "nimai_new";
140
- readonly description: "Scaffolds a new FORGE spec file from the canonical template at the specified output path.";
141
- readonly inputSchema: z.ZodObject<{
142
- outputPath: z.ZodString;
143
- }, "strip", z.ZodTypeAny, {
144
- outputPath: string;
145
- }, {
146
- outputPath: string;
147
- }>;
148
- };
149
- readonly nimai_spec_review: {
150
- readonly name: "nimai_spec_review";
83
+ readonly nimai_review: {
84
+ readonly name: "nimai_review";
151
85
  readonly description: string;
152
86
  readonly inputSchema: z.ZodObject<{
153
87
  specPath: z.ZodString;
88
+ target: z.ZodEnum<["spec", "implementation"]>;
154
89
  }, "strip", z.ZodTypeAny, {
155
90
  specPath: string;
91
+ target: "spec" | "implementation";
156
92
  }, {
157
93
  specPath: string;
94
+ target: "spec" | "implementation";
158
95
  }>;
159
96
  };
160
97
  };
@@ -1 +1 @@
1
- {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAIzD,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;EAExB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;EAE/B,CAAC;AAIH,MAAM,WAAW,eAAe;IAC9B,+EAA+E;IAC/E,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB;;;;;OAKG;IACH,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB;;;;OAIG;IACH,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,oDAAoD;IACpD,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,qBAAqB,EAAE,MAAM,CAAC;CAC/B;AAID,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsEnB,CAAC"}
1
+ {"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;EAM3B,CAAC;AAIH,MAAM,WAAW,eAAe;IAC9B,oFAAoF;IACpF,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,oDAAoD;IACpD,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,iEAAiE;IACjE,cAAc,EAAE,MAAM,CAAC;CACxB;AAID,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuCnB,CAAC"}
package/dist/contract.js CHANGED
@@ -1,103 +1,70 @@
1
1
  "use strict";
2
2
  /**
3
- * FORGE MCP Tool Contract — v1
3
+ * Nimai MCP Tool Contract — v2 (v0.5.0)
4
4
  *
5
+ * Exactly 3 tools: nimai_spec, nimai_validate, nimai_review.
5
6
  * All tool schemas are defined and locked here before server implementation.
6
7
  * Do NOT change tool names or output shapes without a contract version bump.
7
8
  *
8
- * Adversarial review notes (stress-tested before locking):
9
+ * Contract notes:
9
10
  * - Tool names prefixed with "nimai_" to avoid collisions with host tool namespaces
10
11
  * - All inputs validated with zod to prevent runtime shape errors
11
12
  * - Outputs are plain serialisable objects (no class instances, no Buffers)
12
- * - No LLM calls inside any tool — tools return context/structure only
13
+ * - No LLM calls inside any tool — tools return prompts/structure only
13
14
  * - specPath / repoPath are absolute or relative to cwd; server does NOT resolve ~
14
- * - outputPath for nimai_new: parent directory is created if missing; write errors surface as tool errors
15
15
  */
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.TOOL_DESCRIPTORS = exports.ForgeSpecReviewInput = exports.ForgeNewInput = exports.ForgeValidateInput = exports.ForgeReviewInput = exports.ForgeSpecInput = void 0;
17
+ exports.TOOL_DESCRIPTORS = exports.ForgeReviewInput = exports.ForgeValidateInput = exports.ForgeSpecInput = void 0;
18
18
  const zod_1 = require("zod");
19
19
  // ─── Input Schemas ────────────────────────────────────────────────────────────
20
20
  exports.ForgeSpecInput = zod_1.z.object({
21
21
  repoPath: zod_1.z.string().describe('Absolute path to the repository root'),
22
- request: zod_1.z.string().min(1).describe('The loose request to turn into a spec prompt'),
23
- });
24
- exports.ForgeReviewInput = zod_1.z.object({
25
- specPath: zod_1.z.string().describe('Path to the approved spec markdown file'),
22
+ request: zod_1.z.string().min(1).describe('The loose request to turn into a spec'),
26
23
  });
27
24
  exports.ForgeValidateInput = zod_1.z.object({
28
25
  specPath: zod_1.z.string().describe('Path to the spec markdown file to lint'),
29
26
  });
30
- exports.ForgeNewInput = zod_1.z.object({
31
- outputPath: zod_1.z.string().min(1).describe('Path where the new spec file should be written'),
32
- });
33
- exports.ForgeSpecReviewInput = zod_1.z.object({
34
- specPath: zod_1.z.string().describe('Path to the draft spec markdown file to evaluate'),
27
+ exports.ForgeReviewInput = zod_1.z.object({
28
+ specPath: zod_1.z.string().describe('Path to the spec markdown file'),
29
+ target: zod_1.z.enum(['spec', 'implementation']).describe('What to review: "spec" evaluates spec quality (use before building); ' +
30
+ '"implementation" evaluates whether a build satisfies the spec (use after building)'),
35
31
  });
36
32
  // ─── Tool Descriptors (used to register tools in the MCP server) ──────────────
37
33
  exports.TOOL_DESCRIPTORS = {
38
34
  nimai_spec: {
39
35
  name: 'nimai_spec',
40
- description: 'Returns a populated FORGE Self-Spec Agent prompt (Prompt 1) plus extracted repo context. ' +
41
- 'The host model uses this bundle to fill a draft spec no LLM call is made inside this tool. ' +
36
+ description: 'Returns the Nimai spec protocol prompt — a four-phase protocol (EXPLORE INTERVIEW DRAFT GATE) ' +
37
+ 'that the host model runs to turn a loose request into a graded, build-ready spec. ' +
38
+ 'Nimai performs no repo reading and generates no questions itself — the host model does all of that. ' +
42
39
  'IMPORTANT: repoPath must be the specific project directory you are writing the spec for — not a parent directory, home directory, or workspace root. ' +
43
- 'Also returns existing_specs: paths of nimai-managed spec files already in the repo. ' +
44
- 'If existing_specs is empty, you MUST call nimai_new immediately as the next action (no asking, no narration), then fill it using the returned prompt. ' +
45
- 'If existing_specs is non-empty, inspect each path: if one is clearly for this same feature/request, fill it. ' +
46
- 'If none are relevant (different project, different domain, different feature), treat as greenfield — call nimai_new and fill the new file instead. ' +
47
- 'Never update an existing spec file that belongs to a different feature or project. ' +
48
- 'After filling: call nimai_validate. ' +
49
- 'After nimai_validate passes, tell the user to open a fresh reviewer session and ask it to call nimai_spec_review. The builder must not perform the review in the same session. ' +
50
- 'Scope boundary: this tool produces spec prompts/contracts only. ' +
51
- 'Nimai defines and enforces spec-quality contracts; ChatMasala executes agent workflows against those contracts; context platforms provide the execution substrate. ' +
52
- 'It does not orchestrate runtime execution, retries, agent routing, or session control.',
40
+ 'After receiving the protocol prompt: run the four phases in order. ' +
41
+ 'PHASE 1: explore the repo with your own tools. ' +
42
+ 'PHASE 2: ask the user 5–8 specific clarifying questions, then choose the tier (lite or full). ' +
43
+ 'PHASE 3: fill the embedded tier template completely. ' +
44
+ 'PHASE 4: run nimai_validate, then nimai_review with target "spec" in a FRESH session, iterate until verdict passes. ' +
45
+ 'Scope boundary: Nimai defines spec quality contracts only — it does not orchestrate runtime execution, retries, or agent routing.',
53
46
  inputSchema: exports.ForgeSpecInput,
54
47
  },
55
- nimai_review: {
56
- name: 'nimai_review',
57
- description: 'USE THIS AFTER BUILDING: returns a Reviewer/Validator prompt (Prompt 2) to check whether an ' +
58
- 'implementation satisfies an approved spec. ' +
59
- 'For checking spec quality BEFORE building, use nimai_spec_review instead.',
60
- inputSchema: exports.ForgeReviewInput,
61
- },
62
48
  nimai_validate: {
63
49
  name: 'nimai_validate',
64
- description: 'Lints a spec file for unresolved placeholder fields (___), [NEEDS HUMAN INPUT] flags, ' +
65
- 'missing required sections, and pre-checked acceptance criteria. Returns structured issues and a pass/fail result. ' +
66
- 'Run this after filling a spec and again after every fix. ' +
67
- 'If passed: true, output the following to the user as a clearly separated block — ' +
68
- 'use a blank line before and after, and format the instruction as a distinct visual section:\n\n' +
69
- ' Spec passed validation.\n\n' +
70
- '--- REVIEWER HANDOFF ---\n' +
71
- 'Open a fresh reviewer session and give it this instruction:\n\n' +
72
- ' Please call nimai_spec_review({ specPath: \'<ACTUAL PATH>\' })\n' +
73
- ' and evaluate the result.\n\n' +
74
- '------------------------\n\n' +
75
- 'Replace <ACTUAL PATH> with the exact specPath that was validated. Do not use a placeholder. ' +
76
- 'The builder must not call nimai_spec_review itself — not on the first pass, not after a fix iteration, not ever. ' +
77
- 'This REVIEWER HANDOFF block must be output every time passed: true, whether it is the first validation or a re-validation after fixing reviewer feedback. ' +
78
- 'If this is a re-validation after reviewer feedback, output `--- RE-REVIEW HANDOFF ---` instead, include a short "Changes applied" bullet list, and instruct reviewer to evaluate fresh from current prompt output only (do not reuse prior evaluation context).',
50
+ description: 'Lints a spec file for structural issues: blank placeholders, missing required sections (tier-aware), ' +
51
+ 'pre-checked acceptance criteria, and unresolved convergence. Returns structured issues and a pass/fail result. ' +
52
+ 'Run this after filling a spec and again after every fix iteration. ' +
53
+ 'When passed: true, proceed to nimai_review with target "spec" in a FRESH reviewer session — ' +
54
+ 'the drafter must not review its own spec. ' +
55
+ 'When re-validating after reviewer feedback: open a fresh reviewer session for re-review; ' +
56
+ 'do not continue the existing reviewer conversation.',
79
57
  inputSchema: exports.ForgeValidateInput,
80
58
  },
81
- nimai_new: {
82
- name: 'nimai_new',
83
- description: 'Scaffolds a new FORGE spec file from the canonical template at the specified output path.',
84
- inputSchema: exports.ForgeNewInput,
85
- },
86
- nimai_spec_review: {
87
- name: 'nimai_spec_review',
88
- description: 'Primary owner: independent reviewer in a fresh session. ' +
89
- 'Returns Prompt 1.5 spec-quality review checklist for the spec at specPath. ' +
90
- 'The reviewer evaluates the spec and outputs a verdict. ' +
91
- 'If issues are non-empty (including SOFT_FAIL/NOTE with passed=true), reviewer must output a Builder Brief ' +
92
- '(header: \'## Paste this to your builder session:\') with one fix instruction per issue. ' +
93
- 'The builder must not perform the review in the same session it wrote the spec — ' +
94
- 'independent review requires a fresh session with no builder context. ' +
95
- 'Every re-review is a fresh evaluation pass: use only the current prompt output and do not reuse prior verdict context as evidence. ' +
96
- 'For reviewing an implementation against an approved spec, use nimai_review instead. ' +
97
- 'Scope boundary: this tool governs spec quality review contracts only. ' +
98
- 'Nimai defines and enforces spec-quality contracts; ChatMasala executes agent workflows against those contracts; context platforms provide the execution substrate. ' +
99
- 'It does not execute implementation workflows or runtime orchestration.',
100
- inputSchema: exports.ForgeSpecReviewInput,
59
+ nimai_review: {
60
+ name: 'nimai_review',
61
+ description: 'Returns a reviewer prompt for the spec at specPath. ' +
62
+ 'target="spec": returns the Spec-Quality Reviewer (Prompt 1.5) — use BEFORE building to evaluate spec quality. ' +
63
+ 'target="implementation": returns the Implementation Reviewer (Prompt 2) — use AFTER building to check whether the implementation satisfies the spec. ' +
64
+ 'The returned prompt must be evaluated by an independent reviewer in a FRESH session — ' +
65
+ 'not the same agent that drafted the spec or built the implementation. ' +
66
+ 'Every re-review is a fresh evaluation: start a new conversation, do not reuse prior verdict context.',
67
+ inputSchema: exports.ForgeReviewInput,
101
68
  },
102
69
  };
103
70
  //# sourceMappingURL=contract.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,6BAAwB;AAGxB,iFAAiF;AAEpE,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACrE,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;CACpF,CAAC,CAAC;AAEU,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CACzE,CAAC,CAAC;AAEU,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;CACxE,CAAC,CAAC;AAEU,QAAA,aAAa,GAAG,OAAC,CAAC,MAAM,CAAC;IACpC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,gDAAgD,CAAC;CACzF,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3C,QAAQ,EAAE,OAAC,CAAC,MAAM,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KAChC;IACD,YAAY,EAAE;QACZ,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,sDAAsD;YACtD,gHAAgH;YAChH,uJAAuJ;YACvJ,wFAAwF;YACxF,wEAAwE;YACxE,sGAAsG;QACxG,WAAW,EAAE,wBAAgB;KAC9B;CACO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAgBnE,wBAAgB,YAAY,IAAI,MAAM,CAuErC;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAIjD"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAcnE,wBAAgB,YAAY,IAAI,MAAM,CA6DrC;AAED,wBAAsB,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC,CAIjD"}
package/dist/server.js CHANGED
@@ -7,10 +7,8 @@ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
7
7
  const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
8
8
  const contract_1 = require("./contract");
9
9
  const spec_1 = require("./tools/spec");
10
- const review_1 = require("./tools/review");
11
10
  const validate_1 = require("./tools/validate");
12
- const new_1 = require("./tools/new");
13
- const spec_review_1 = require("./tools/spec-review");
11
+ const review_1 = require("./tools/review");
14
12
  // eslint-disable-next-line @typescript-eslint/no-require-imports
15
13
  const { version } = require('../package.json');
16
14
  function createServer() {
@@ -39,24 +37,14 @@ function createServer() {
39
37
  result = await (0, spec_1.toolSpec)(input);
40
38
  break;
41
39
  }
42
- case 'nimai_review': {
43
- const input = contract_1.ForgeReviewInput.parse(args);
44
- result = await (0, review_1.toolReview)(input);
45
- break;
46
- }
47
40
  case 'nimai_validate': {
48
41
  const input = contract_1.ForgeValidateInput.parse(args);
49
42
  result = await (0, validate_1.toolValidate)(input);
50
43
  break;
51
44
  }
52
- case 'nimai_new': {
53
- const input = contract_1.ForgeNewInput.parse(args);
54
- result = await (0, new_1.toolNew)(input);
55
- break;
56
- }
57
- case 'nimai_spec_review': {
58
- const input = contract_1.ForgeSpecReviewInput.parse(args);
59
- result = await (0, spec_review_1.toolSpecReview)(input);
45
+ case 'nimai_review': {
46
+ const input = contract_1.ForgeReviewInput.parse(args);
47
+ result = await (0, review_1.toolReview)(input);
60
48
  break;
61
49
  }
62
50
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";;AAgBA,oCAuEC;AAED,kCAIC;AA7FD,wEAAmE;AACnE,wEAAiF;AACjF,iEAG4C;AAC5C,yCAAyI;AACzI,uCAAwC;AACxC,2CAA4C;AAC5C,+CAAgD;AAChD,qCAAsC;AACtC,qDAAqD;AAErD,iEAAiE;AACjE,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE,SAAgB,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,iBAAM,CACvB,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAC1B,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAChC,CAAC;IAEF,MAAM,CAAC,iBAAiB,CAAC,iCAAsB,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QAC5D,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,2BAAgB,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACxD,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,WAAW,EAAE;gBACX,IAAI,EAAE,QAAiB;gBACvB,UAAU,EAAE,MAAM,CAAC,WAAW,CAC5B,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,KAAK,CA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AClC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/tools/review.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAsB,UAAU,CAC9B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAmB5B"}
1
+ {"version":3,"file":"review.d.ts","sourceRoot":"","sources":["../../src/tools/review.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAsB,UAAU,CAC9B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,iBAAiB,CAAC,CAgB5B"}
@@ -46,10 +46,9 @@ async function toolReview(input) {
46
46
  catch (err) {
47
47
  throw new Error(`Cannot read spec at "${specPath}": ${err.message}`);
48
48
  }
49
- const hardIssues = (0, nimai_core_1.lintContent)(specContent).filter(i => !i.advisory);
50
- if (hardIssues.length > 0) {
51
- throw new Error(`Spec has ${hardIssues.length} unfilled field(s) — run nimai_validate to see them, then nimai_spec to generate a filled draft before reviewing.`);
52
- }
53
- return { reviewerPrompt: (0, nimai_core_1.buildPrompt2)(specContent) };
49
+ const reviewerPrompt = input.target === 'spec'
50
+ ? (0, nimai_core_1.buildPrompt15)(specContent)
51
+ : (0, nimai_core_1.buildPrompt2)(specContent);
52
+ return { reviewerPrompt };
54
53
  }
55
54
  //# sourceMappingURL=review.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"review.js","sourceRoot":"","sources":["../../src/tools/review.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,wBAAwB,QAAQ,MAAO,GAA6B,CAAC,OAAO,EAAE,CAC/E,CAAC;IACJ,CAAC;IAED,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,KAAK,MAAM;QAC5C,CAAC,CAAC,IAAA,0BAAa,EAAC,WAAW,CAAC;QAC5B,CAAC,CAAC,IAAA,yBAAY,EAAC,WAAW,CAAC,CAAC;IAE9B,OAAO,EAAE,cAAc,EAAE,CAAC;AAC5B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/tools/spec.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,GACpC,OAAO,CAAC,eAAe,CAAC,CAuB1B"}
1
+ {"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/tools/spec.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAsB,QAAQ,CAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,GACpC,OAAO,CAAC,eAAe,CAAC,CAY1B"}
@@ -42,17 +42,9 @@ async function toolSpec(input) {
42
42
  if (!fs.existsSync(repoPath)) {
43
43
  throw new Error(`repoPath does not exist: ${repoPath}`);
44
44
  }
45
- const context = (0, nimai_core_1.extractContext)(repoPath, input.request);
46
- const contextSummary = context
47
- .map(item => `[${item.file}]\n${item.snippet}`)
48
- .join('\n\n---\n\n');
49
- const prompt = (0, nimai_core_1.buildPrompt1)(input.request, contextSummary);
50
- const existingSpecs = (0, nimai_core_1.findNimaiSpecs)(repoPath).map(s => s.filePath);
51
- const result = { prompt, context, existing_specs: existingSpecs };
52
- const clarification = (0, nimai_core_1.detectClarifications)(input.request, context.length);
53
- if (clarification.needed) {
54
- result.clarifications_needed = clarification.questions;
55
- }
56
- return result;
45
+ const liteTemplate = (0, nimai_core_1.loadTierTemplate)('lite');
46
+ const fullTemplate = (0, nimai_core_1.loadTierTemplate)('full');
47
+ const protocolPrompt = (0, nimai_core_1.buildSpecProtocol)(input.request, repoPath, liteTemplate, fullTemplate);
48
+ return { protocolPrompt };
57
49
  }
58
50
  //# sourceMappingURL=spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spec.js","sourceRoot":"","sources":["../../src/tools/spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,4BAyBC;AA/BD,uCAAyB;AACzB,2CAA6B;AAC7B,2CAAgG;AAIzF,KAAK,UAAU,QAAQ,CAC5B,KAAqC;IAErC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,4BAA4B,QAAQ,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,MAAM,OAAO,GAAG,IAAA,2BAAc,EAAC,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IAExD,MAAM,cAAc,GAAG,OAAO;SAC3B,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;SAC9C,IAAI,CAAC,aAAa,CAAC,CAAC;IAEvB,MAAM,MAAM,GAAG,IAAA,yBAAY,EAAC,KAAK,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAE3D,MAAM,aAAa,GAAG,IAAA,2BAAc,EAAC,QA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version": "0.5.0",
4
4
  "description": "Nimai MCP server — exposes nimai_spec, nimai_review, nimai_validate, nimai_new, nimai_spec_review as tools. No internal LLM calls.",
5
5
  "keywords": [
6
6
  "nimai",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@modelcontextprotocol/sdk": "^1.0.0",
38
38
  "zod": "^3.23.8",
39
- "nimai-core": "0.4.9"
39
+ "nimai-core": "0.5.0"
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsc",
@@ -1,454 +0,0 @@
1
- # FORGE Spec Template
2
- > **You are here:** This is the Spec Template — the execution tool. Use it to turn a project direction into a complete agent-ready brief.
3
- >
4
- > **The other docs in this system:**
5
- > - **Quick Reference** (`FORGE-quickref.md`) — start here if you don't have a project direction yet. If the request is a new idea or open-ended, go to the Quick Reference and run the Divergence → Convergence Loop or the Self-Spec Agent first. Come back here once you have a chosen direction.
6
- > - **Canonical Framework** (`FORGE-canonical.md`) — go there if you encounter a concept in this template you don't fully understand. Each section maps to a section in the canonical doc.
7
- >
8
- > **When to be in this doc:** You have a specific project or direction. You are ready to define it completely before handing it to an agent. If you can't fill in a field, that is an unresolved decision — resolve it here, not mid-run.
9
- >
10
- > **Solo operator shortcut:** Instead of filling this manually, use the Self-Spec Agent prompt in the Quick Reference to generate a draft, then review and approve it here.
11
-
12
- ---
13
-
14
- > Fill in every field before handing to an agent. A blank field is an unresolved decision — resolve it here, not mid-run.
15
- > *Based on the FORGE*
16
-
17
- ---
18
-
19
- ## 0. Pre-Flight Decisions
20
- > These must be set first. Everything else is built on top of them.
21
-
22
- **Risk Tier:** [ ] Low [ ] Medium [ ] High
23
- *(If unsure, go one tier higher)*
24
-
25
- **Primary Cognitive Mode for this project:**
26
- [ ] Deterministic [ ] Exploratory [ ] Adversarial [ ] Synthesis [ ] Audit
27
- [ ] Multi-phase — using Divergence → Convergence Loop (see Section 6)
28
- *→ Unsure which mode? See Cognitive Mode table in Quick Reference or Canonical doc.*
29
-
30
- **Resource Governance:**
31
- - Model tier (Planner): `_______________`
32
- - Model tier (Workers): `_______________`
33
- - Max runtime per sub-task: `_______________`
34
- - Total compute / cost budget: `_______________`
35
- - Retry limit before escalation: `_______________`
36
- - Cost threshold that triggers stop-and-report: `_______________`
37
-
38
- ---
39
-
40
- ## 1. Specification Layer — The Blueprint
41
-
42
- ### 1.1 Final Deliverable
43
- *Describe precisely. Not "a good analysis" — describe the exact artifact, format, and measurable quality.*
44
-
45
- ```
46
- Deliverable: _______________________________________________
47
-
48
- Format: ___________________________________________________
49
-
50
- Length / Size: _____________________________________________
51
-
52
- Measurable quality bar: ____________________________________
53
-
54
- Benchmark dataset (if quality bar requires measurement):
55
- path: _______________ (e.g. tests/fixtures/receipts/ or N/A)
56
- schema: _____________ (field names and types of each labeled example, or N/A)
57
- threshold computation rule: ___ (e.g. "pass rate = correct / total labeled examples", or N/A)
58
- ```
59
-
60
- ### 1.2 Scope Boundaries
61
- *Be explicit. Ambiguity here becomes scope creep mid-run.*
62
-
63
- **In scope:**
64
- - `_______________`
65
- - `_______________`
66
- - `_______________`
67
-
68
- **Out of scope (Must-Not):**
69
- - `_______________`
70
- - `_______________`
71
- - `_______________`
72
-
73
- ### 1.3 Task Decomposition
74
- *Break the project into sub-tasks. Each must satisfy the 5 Primitives and complete in under 2 hours.*
75
- *→ Need a reminder of the 5 Primitives? See Quick Reference or Canonical doc Section "5 Primitives."*
76
-
77
- | # | Sub-task | Cognitive Mode | Risk Tier | Acceptance Criteria | Eval Method |
78
- |---|---|---|---|---|---|
79
- | 1 | | | | | |
80
- | 2 | | | | | |
81
- | 3 | | | | | |
82
- | 4 | | | | | |
83
- | 5 | | | | | |
84
-
85
- *Add rows as needed. Every sub-task needs all five columns filled.*
86
-
87
- *Note: Sub-task risk tiers may differ from the overall project tier. A research sub-task and a production deployment sub-task in the same project have different risk profiles — assign each independently. The project-level tier sets the floor for escalation; sub-task tiers govern validation routing.*
88
-
89
- ### 1.4 Acceptance Criteria — Master Definition of Done
90
- *Binary. Measurable. No subjective criteria.*
91
-
92
- The project is complete when ALL of the following are true:
93
- - [ ] `_______________`
94
- - [ ] `_______________`
95
- - [ ] `_______________`
96
-
97
- ---
98
-
99
- ## 1.5 Mechanism Decision
100
- *One block per core architectural or algorithmic choice. If no core mechanism applies, write "N/A" and justify.*
101
- *A builder must be able to start coding without choosing missing architecture. If any mechanism is undecided, resolve it here first.*
102
-
103
- ---
104
-
105
- **Decision: [short name, e.g., "Primary parsing method"]**
106
-
107
- ```
108
- Chosen approach: _______________________________________________
109
-
110
- Rejected alternatives: _________________________________________
111
-
112
- Why rejected: __________________________________________________
113
-
114
- Impact on ACs: _________________________________________________
115
- ```
116
-
117
- ---
118
-
119
- ## 1.6 Architecture Lock
120
- *Required for medium/high coding specs. Advisory for low/unknown/non-coding specs.*
121
- *All fields must be resolved before builder handoff. Blank placeholders and "TBD" are unresolved.*
122
-
123
- ```
124
- Persistence layer: _______________________________________________
125
-
126
- File/object storage: _____________________________________________
127
-
128
- External model/service + env var: ________________________________
129
-
130
- API trigger flow: ________________________________________________
131
-
132
- Entity status state machine: _____________________________________
133
-
134
- Auth implementation: _____________________________________________
135
- ```
136
-
137
- ---
138
-
139
- ## 2. Intent Layer — The Compass
140
-
141
- ### 2.1 Agent Deployment Purpose
142
- *Tell the agent what it is, what it is not, and who consumes its output. One clear paragraph.*
143
-
144
- ```
145
- You are: ___________________________________________________
146
-
147
- You are NOT responsible for: _______________________________
148
-
149
- Your output is consumed by: ________________________________
150
- (human decision-maker / another agent / automated pipeline)
151
-
152
- Your output feeds into: ____________________________________
153
- ```
154
-
155
- ### 2.2 Trade-off Hierarchy
156
- *Rank these in order of priority. The agent will use this when it hits a fork.*
157
-
158
- Rank the following from 1 (highest) to n (lowest) for this task:
159
-
160
- | Priority | Value |
161
- |---|---|
162
- | `___` | Accuracy / Correctness |
163
- | `___` | Speed / Efficiency |
164
- | `___` | Cost / Token economy |
165
- | `___` | Safety / Risk avoidance |
166
- | `___` | Novelty / Creativity |
167
- | `___` | Completeness |
168
- | `___` | Simplicity / Readability |
169
- | `___` | *(add domain-specific value)* |
170
-
171
- ### 2.3 Constraint Architecture
172
-
173
- **Must (non-negotiable requirements):**
174
- - `_______________`
175
- - `_______________`
176
-
177
- **Must-Not (hard prohibitions):**
178
- - `_______________`
179
- - `_______________`
180
-
181
- **Prefer (soft preferences when trade-offs arise):**
182
- - `_______________`
183
- - `_______________`
184
-
185
- **Escalate (stop and surface to human when):**
186
- - `_______________`
187
- - `_______________`
188
-
189
- ### 2.4 Forbidden Approaches
190
- *Specific methods, tools, frameworks, or reasoning patterns to avoid.*
191
-
192
- - `_______________`
193
- - `_______________`
194
-
195
- ---
196
-
197
- ## 3. Context Layer — The Environment
198
-
199
- ### 3.1 Provided Context
200
- *List all documents, artifacts, or data sources being provided. Mark each as AUTHORITATIVE or REFERENCE.*
201
-
202
- | Source | Type | Authority Level | Notes |
203
- |---|---|---|---|
204
- | | | AUTHORITATIVE / REFERENCE | |
205
- | | | AUTHORITATIVE / REFERENCE | |
206
- | | | AUTHORITATIVE / REFERENCE | |
207
-
208
- ### 3.2 Known State
209
- *What has already been tried? What failed? What is known?*
210
-
211
- ```
212
- Prior attempts: ____________________________________________
213
-
214
- Known failures / dead ends: ________________________________
215
-
216
- Known constraints: _________________________________________
217
-
218
- Current blockers: __________________________________________
219
- ```
220
-
221
- ### 3.3 Context Freshness
222
- *Tell the agent when to trust the provided context vs. when to re-fetch or verify.*
223
-
224
- [ ] All provided context is current — use as ground truth
225
- [ ] The following sources may be stale and should be verified: `_______________`
226
- [ ] The agent must re-fetch live data for: `_______________`
227
- [ ] MCP connections available: `_______________`
228
-
229
- ### 3.4 Domain Conventions
230
- *Terminology, style, standards, or norms the agent must match.*
231
-
232
- ```
233
- Terminology to use: ________________________________________
234
-
235
- Terminology to avoid: ______________________________________
236
-
237
- Style / format standards: __________________________________
238
-
239
- Domain-specific conventions: _______________________________
240
- ```
241
-
242
- ---
243
-
244
- ## 4. Prompt Layer — The Trigger
245
-
246
- ### 4.1 Opening System Instruction
247
- *The master instruction that frames the entire run. Reference Sections 1–3 explicitly.*
248
-
249
- ```
250
- You are [deployment purpose from 2.1].
251
-
252
- Your task is to produce [deliverable from 1.1].
253
-
254
- You are operating within the following constraints: [from 2.3].
255
-
256
- Your trade-off priority order is: [from 2.2].
257
-
258
- The context you have been provided is: [from 3.1].
259
-
260
- You will complete this task by executing the following sub-tasks in order: [from 1.3].
261
-
262
- For each sub-task, your completion criterion is: [from 1.4].
263
- ```
264
-
265
- ### 4.2 Per-Sub-Task Prompt Template
266
- *Use this template for each sub-task trigger.*
267
-
268
- ```
269
- Sub-task [#]: [name]
270
- Cognitive mode: [mode]
271
- Your input: [what you're working from]
272
- Your output: [exact format and content required]
273
- Acceptance criteria: [binary criteria from 1.3]
274
- Evaluation: [how this will be checked]
275
- Resource cap: [max runtime / tokens for this sub-task]
276
- ```
277
-
278
- ---
279
-
280
- ## 5. Governance & Validation
281
-
282
- ### 5.1 Escalation Contract
283
-
284
- **Escalation triggers** *(from 2.3 — repeated here for executor clarity)*:
285
- - `_______________`
286
- - `_______________`
287
-
288
- **Who reviews escalations:**
289
- ```
290
- Name / Role: _______________________________________________
291
- Contact: __________________________________________________
292
- Response SLA: ______________________________________________
293
- ```
294
-
295
- **If no response arrives within SLA, the agent should:**
296
- [ ] Hold and wait
297
- [ ] Attempt alternative path: `_______________`
298
- [ ] Abort and report
299
-
300
- ### 5.2 Adversarial Reflection Trigger
301
- *(Required for Medium and High risk tasks)*
302
-
303
- [ ] Not required (Low risk)
304
- [ ] Required after sub-task(s): `_______________`
305
- [ ] Required before final delivery
306
-
307
- The agent should critique: `_______________`
308
- The revision threshold is: `_______________` *(what level of critique warrants a revision?)*
309
-
310
- ### 5.3 Uncertainty Reporting
311
- *(Required for non-deterministic domains)*
312
-
313
- [ ] Not required
314
- [ ] Required — agent must report:
315
- - Confidence estimate (0–100%) with justification
316
- - Primary uncertainty drivers
317
- - What data would most reduce uncertainty
318
- - Alternative plausible interpretations
319
-
320
- ---
321
-
322
- ## 6. Brainstorming Mode (Divergence → Convergence)
323
- *Complete this section only if primary mode is multi-phase brainstorming.*
324
-
325
- **Phase 1 — DIVERGE (Exploratory Mode)**
326
- ```
327
- Generate: _________________________________________________
328
- Constraint: No filtering or judgment at this stage.
329
- Output format: ____________________________________________
330
- Volume target: ____________________________________________
331
- ```
332
-
333
- **Phase 2 — CLUSTER (Synthesis Mode)**
334
- ```
335
- Organize the output of Phase 1 by: ________________________
336
- Identify: _________________________________________________
337
- Output format: ____________________________________________
338
- ```
339
-
340
- **Phase 3 — STRESS-TEST (Adversarial Mode)**
341
- ```
342
- Attack the top [n] candidates from Phase 2.
343
- Criteria to stress-test against: __________________________
344
- Output format: ____________________________________________
345
- What constitutes a fatal flaw: ____________________________
346
- ```
347
-
348
- **Phase 4 — FORMALIZE (Deterministic Mode)**
349
- ```
350
- Selected direction: ______________________________________
351
- Formalize as: ____________________________________________
352
- Acceptance criteria: _____________________________________
353
- ```
354
-
355
- ---
356
-
357
- ## 7. Domain-Specific Additions
358
-
359
- ### If Coding:
360
- - Language / framework / version: `_______________`
361
- - Performance targets: `_______________`
362
- - API / interface contracts: `_______________`
363
- - Security requirements: `_______________`
364
- - Test coverage expectation: `_______________`
365
-
366
- ### If Science / Research:
367
- - Null hypothesis: `_______________`
368
- - Falsification criteria: `_______________`
369
- - Authorized data sources: `_______________`
370
- - Forbidden data sources: `_______________`
371
- - Statistical significance threshold: `_______________`
372
- - Correction method: `_______________`
373
- - Reproducibility requirements: `_______________`
374
-
375
- ### If Writing / Content:
376
- - Audience: `_______________`
377
- - Purpose: `_______________`
378
- - Structure: `_______________`
379
- - Word count / length: `_______________`
380
- - Style reference: `_______________`
381
- - Mandatory inclusions: `_______________`
382
- - Mandatory exclusions: `_______________`
383
-
384
- ### If Business / Strategy:
385
- - Decision-maker: `_______________`
386
- - Decision to be made: `_______________`
387
- - Options to evaluate: `_______________`
388
- - Recommendation format: `_______________`
389
- - Regulatory Must-Nots: `_______________`
390
- - Stakeholder sensitivities: `_______________`
391
-
392
- ---
393
-
394
- ## 8. Spec Validation (Red-Team Checklist)
395
- *Complete before handing to the agent. Every unchecked box is a known risk.*
396
-
397
- **5 Primitives — does every sub-task have:**
398
- - [ ] A self-contained problem statement (zero questions needed to start)
399
- - [ ] A Constraint Architecture (Must / Must-Not / Prefer / Escalate)
400
- - [ ] A runtime under 2 hours
401
- - [ ] Binary acceptance criteria
402
- - [ ] A built-in evaluation method
403
-
404
- **Failure Mode Taxonomy — does this spec prevent:**
405
- - [ ] Scope Creep — explicit Must-Not list and scope boundaries
406
- - [ ] Hallucinated Completion — binary acceptance criteria defined
407
- - [ ] Intent Drift — ranked trade-offs and deployment purpose explicit
408
- - [ ] Context Collapse — context curated; noise removed
409
- - [ ] Runaway Cost — resource caps set before decomposition
410
- - [ ] Overconfident Output — uncertainty reporting required (if applicable)
411
-
412
- **Final gate:**
413
- - [ ] Risk tier and resource governance set *before* decomposition
414
- - [ ] Every agent has a deployment purpose statement
415
- - [ ] Escalation contract complete (who, when, SLA, no-response behavior)
416
- - [ ] Planner execution plan will be saved as artifact
417
-
418
- ---
419
-
420
- ## 8.5 Edge Cases and Failure Modes
421
- > Required for medium/high risk specs. Red-team the spec before builder handoff.
422
- > For each scenario, document what the spec says the builder must do. A blank list is a hard stop.
423
-
424
- **FORGE failure mode coverage:**
425
- - Scope Creep — which Must-Not explicitly prevents it: `_______________`
426
- - Hallucinated Completion — which AC is hardest to fake: `_______________`
427
- - Intent Drift — which decision will the builder most likely get wrong: `_______________`
428
- - Context Collapse — what context is load-bearing and must not be dropped: `_______________`
429
- - Runaway Cost — what resource cap prevents unbounded execution: `_______________`
430
- - Overconfident Output — what requires uncertainty reporting: `_______________`
431
-
432
- **Domain-specific edge cases:**
433
- - `_______________`
434
- - `_______________`
435
-
436
- ---
437
-
438
- ## 9. Spec Convergence
439
- > Fill before handing to a builder. A non-zero count or "no" is a hard stop.
440
- > Every [NEEDS HUMAN INPUT] flag from spec drafting must be resolved before this section is filled.
441
-
442
- ```
443
- open_questions: 0
444
- ambiguities_remaining: 0
445
- ready_for_build: yes
446
- convergence_notes: _______________________________________________
447
- ```
448
-
449
- ---
450
-
451
- *FORGE Spec Template v1.0 — companion to the FORGE system. A blank field is an unresolved decision.*
452
- *System docs: Quick Reference · Canonical Framework · Spec Template (this doc)*
453
-
454
- <!-- nimai-spec -->
@@ -1,4 +0,0 @@
1
- import { ForgeNewInput, ForgeNewOutput } from '../contract';
2
- import { z } from 'zod';
3
- export declare function toolNew(input: z.infer<typeof ForgeNewInput>): Promise<ForgeNewOutput>;
4
- //# sourceMappingURL=new.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../src/tools/new.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE5D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAsB,OAAO,CAC3B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,GACnC,OAAO,CAAC,cAAc,CAAC,CAczB"}
package/dist/tools/new.js DELETED
@@ -1,54 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.toolNew = toolNew;
37
- const fs = __importStar(require("fs"));
38
- const path = __importStar(require("path"));
39
- const nimai_core_1 = require("nimai-core");
40
- const prompts_1 = require("../prompts");
41
- async function toolNew(input) {
42
- const templatePath = path.join(prompts_1.FORGE_ROOT, 'FORGE-spec-template.md');
43
- const template = (0, nimai_core_1.loadTemplate)(templatePath);
44
- const outputPath = path.resolve(input.outputPath);
45
- const dir = path.dirname(outputPath);
46
- if (!fs.existsSync(dir)) {
47
- fs.mkdirSync(dir, { recursive: true });
48
- }
49
- const date = new Date().toISOString().slice(0, 10); // YYYY-MM-DD
50
- const content = template.raw.replace('<!-- nimai-spec -->', `<!-- nimai-spec: ${date} -->`);
51
- fs.writeFileSync(outputPath, content, 'utf-8');
52
- return { path: outputPath, content };
53
- }
54
- //# sourceMappingURL=new.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"new.js","sourceRoot":"","sources":["../../src/tools/new.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,0BAgBC;AAvBD,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA0C;AAE1C,wCAAwC;AAGjC,KAAK,UAAU,OAAO,CAC3B,KAAoC;IAEpC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,oBAAU,EAAE,wBAAwB,CAAC,CAAC;IACrE,MAAM,QAAQ,GAAG,IAAA,yBAAY,EAAC,YAAY,CAAC,CAAC;IAC5C,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAElD,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzC,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa;IACjE,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,oBAAoB,IAAI,MAAM,CAAC,CAAC;IAC5F,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;AACvC,CAAC"}
@@ -1,4 +0,0 @@
1
- import { ForgeSpecReviewInput, ForgeSpecReviewOutput } from '../contract';
2
- import { z } from 'zod';
3
- export declare function toolSpecReview(input: z.infer<typeof ForgeSpecReviewInput>): Promise<ForgeSpecReviewOutput>;
4
- //# sourceMappingURL=spec-review.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec-review.d.ts","sourceRoot":"","sources":["../../src/tools/spec-review.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,wBAAsB,cAAc,CAClC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,GAC1C,OAAO,CAAC,qBAAqB,CAAC,CA2BhC"}
@@ -1,63 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.toolSpecReview = toolSpecReview;
37
- const fs = __importStar(require("fs"));
38
- const path = __importStar(require("path"));
39
- const nimai_core_1 = require("nimai-core");
40
- async function toolSpecReview(input) {
41
- const specPath = path.resolve(input.specPath);
42
- let specContent;
43
- try {
44
- specContent = fs.readFileSync(specPath, 'utf-8');
45
- }
46
- catch (err) {
47
- throw new Error(`Cannot read spec at "${specPath}": ${err.message}`);
48
- }
49
- const specReviewerPrompt = (0, nimai_core_1.buildPrompt15)(specContent);
50
- const reviewer_instructions = `Open a fresh reviewer session with nimai-mcp configured.\n\n` +
51
- `Give it this instruction:\n\n` +
52
- `---\n\n` +
53
- `Please call nimai_spec_review({ specPath: '${specPath}' }) and evaluate the result.\n\n` +
54
- `For first review: evaluate directly from the current prompt output.\n` +
55
- `For re-review after builder fixes: evaluate fresh from the current prompt output only; do not reuse your previous evaluation context.\n\n` +
56
- `The spec content is already embedded in the returned specReviewerPrompt — use that prompt to evaluate the spec. Do not read the spec file separately.\n\n` +
57
- `Return a verdict JSON block at the end of your response:\n` +
58
- `{"passed": true/false, "schema_version": "2", "issues": [...]}\n\n` +
59
- `---\n\n` +
60
- `If the reviewer session does not have nimai-mcp available, paste the following prompt directly:\n\n\`\`\`\n${specReviewerPrompt}\n\`\`\``;
61
- return { specReviewerPrompt, reviewer_instructions };
62
- }
63
- //# sourceMappingURL=spec-review.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spec-review.js","sourceRoot":"","sources":["../../src/tools/spec-review.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wCA6BC;AAnCD,uCAAyB;AACzB,2CAA6B;AAC7B,2CAA2C;AAIpC,KAAK,UAAU,cAAc,CAClC,KAA2C;IAE3C,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9C,IAAI,WAAmB,CAAC;IACxB,IAAI,CAAC;QACH,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,wBAAwB,QAAQ,MAAO,GAA6B,CAAC,OAAO,EAAE,CAC/E,CAAC;IACJ,CAAC;IAED,MAAM,kBAAkB,GAAG,IAAA,0BAAa,EAAC,WAAW,CAAC,CAAC;IAEtD,MAAM,qBAAqB,GACzB,8DAA8D;QAC9D,+BAA+B;QAC/B,SAAS;QACT,8CAA8C,QAAQ,mCAAmC;QACzF,uEAAuE;QACvE,2IAA2I;QAC3I,2JAA2J;QAC3J,4DAA4D;QAC5D,oEAAoE;QACpE,SAAS;QACT,8GAA8G,kBAAkB,UAAU,CAAC;IAE7I,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,CAAC;AACvD,CAAC"}