metaintent 0.0.0-stage → 3.1.1

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 (92) hide show
  1. package/.env.example +32 -0
  2. package/LICENSE +21 -0
  3. package/README.md +412 -3
  4. package/dist/adapters/LLMAdapterFactory.d.ts +12 -0
  5. package/dist/adapters/LLMAdapterFactory.d.ts.map +1 -0
  6. package/dist/adapters/LLMAdapterFactory.js +44 -0
  7. package/dist/adapters/LLMAdapterFactory.js.map +1 -0
  8. package/dist/adapters/NIMAdapter.d.ts +15 -0
  9. package/dist/adapters/NIMAdapter.d.ts.map +1 -0
  10. package/dist/adapters/NIMAdapter.js +138 -0
  11. package/dist/adapters/NIMAdapter.js.map +1 -0
  12. package/dist/adapters/OllamaAdapter.d.ts +14 -0
  13. package/dist/adapters/OllamaAdapter.d.ts.map +1 -0
  14. package/dist/adapters/OllamaAdapter.js +129 -0
  15. package/dist/adapters/OllamaAdapter.js.map +1 -0
  16. package/dist/cli.d.ts +9 -0
  17. package/dist/cli.d.ts.map +1 -0
  18. package/dist/cli.js +138 -0
  19. package/dist/cli.js.map +1 -0
  20. package/dist/local-server.d.ts +6 -0
  21. package/dist/local-server.d.ts.map +1 -0
  22. package/dist/local-server.js +321 -0
  23. package/dist/local-server.js.map +1 -0
  24. package/dist/mcp-server.d.ts +10 -0
  25. package/dist/mcp-server.d.ts.map +1 -0
  26. package/dist/mcp-server.js +285 -0
  27. package/dist/mcp-server.js.map +1 -0
  28. package/dist/models/constants.d.ts +30 -0
  29. package/dist/models/constants.d.ts.map +1 -0
  30. package/dist/models/constants.js +68 -0
  31. package/dist/models/constants.js.map +1 -0
  32. package/dist/models/errors.d.ts +23 -0
  33. package/dist/models/errors.d.ts.map +1 -0
  34. package/dist/models/errors.js +56 -0
  35. package/dist/models/errors.js.map +1 -0
  36. package/dist/models/types.d.ts +28 -0
  37. package/dist/models/types.d.ts.map +1 -0
  38. package/dist/models/types.js +4 -0
  39. package/dist/models/types.js.map +1 -0
  40. package/dist/services/AgentGenerator.d.ts +36 -0
  41. package/dist/services/AgentGenerator.d.ts.map +1 -0
  42. package/dist/services/AgentGenerator.js +291 -0
  43. package/dist/services/AgentGenerator.js.map +1 -0
  44. package/dist/services/AmbiguityDetector.d.ts +25 -0
  45. package/dist/services/AmbiguityDetector.d.ts.map +1 -0
  46. package/dist/services/AmbiguityDetector.js +156 -0
  47. package/dist/services/AmbiguityDetector.js.map +1 -0
  48. package/dist/services/ClarificationPolicy.d.ts +113 -0
  49. package/dist/services/ClarificationPolicy.d.ts.map +1 -0
  50. package/dist/services/ClarificationPolicy.js +494 -0
  51. package/dist/services/ClarificationPolicy.js.map +1 -0
  52. package/dist/services/GoalEchoGenerator.d.ts +17 -0
  53. package/dist/services/GoalEchoGenerator.d.ts.map +1 -0
  54. package/dist/services/GoalEchoGenerator.js +109 -0
  55. package/dist/services/GoalEchoGenerator.js.map +1 -0
  56. package/dist/services/IntentSnapshot.d.ts +34 -0
  57. package/dist/services/IntentSnapshot.d.ts.map +1 -0
  58. package/dist/services/IntentSnapshot.js +95 -0
  59. package/dist/services/IntentSnapshot.js.map +1 -0
  60. package/dist/services/LockedIntent.d.ts +38 -0
  61. package/dist/services/LockedIntent.d.ts.map +1 -0
  62. package/dist/services/LockedIntent.js +122 -0
  63. package/dist/services/LockedIntent.js.map +1 -0
  64. package/dist/services/MetaLoopEngine.d.ts +59 -0
  65. package/dist/services/MetaLoopEngine.d.ts.map +1 -0
  66. package/dist/services/MetaLoopEngine.js +285 -0
  67. package/dist/services/MetaLoopEngine.js.map +1 -0
  68. package/dist/services/ProjectBootstrap.d.ts +44 -0
  69. package/dist/services/ProjectBootstrap.d.ts.map +1 -0
  70. package/dist/services/ProjectBootstrap.js +208 -0
  71. package/dist/services/ProjectBootstrap.js.map +1 -0
  72. package/dist/services/SecurityGuardrail.d.ts +14 -0
  73. package/dist/services/SecurityGuardrail.d.ts.map +1 -0
  74. package/dist/services/SecurityGuardrail.js +159 -0
  75. package/dist/services/SecurityGuardrail.js.map +1 -0
  76. package/dist/services/SubAgentOrchestrator.d.ts +43 -0
  77. package/dist/services/SubAgentOrchestrator.d.ts.map +1 -0
  78. package/dist/services/SubAgentOrchestrator.js +302 -0
  79. package/dist/services/SubAgentOrchestrator.js.map +1 -0
  80. package/dist/services/runBootstrap.d.ts +28 -0
  81. package/dist/services/runBootstrap.d.ts.map +1 -0
  82. package/dist/services/runBootstrap.js +68 -0
  83. package/dist/services/runBootstrap.js.map +1 -0
  84. package/dist/utils/backendHealth.d.ts +27 -0
  85. package/dist/utils/backendHealth.d.ts.map +1 -0
  86. package/dist/utils/backendHealth.js +56 -0
  87. package/dist/utils/backendHealth.js.map +1 -0
  88. package/dist/utils/llm.d.ts +8 -0
  89. package/dist/utils/llm.d.ts.map +1 -0
  90. package/dist/utils/llm.js +81 -0
  91. package/dist/utils/llm.js.map +1 -0
  92. package/package.json +72 -6
package/.env.example ADDED
@@ -0,0 +1,32 @@
1
+ PORT=8787
2
+
3
+ # Where bootstrap writes metaintent-projects/
4
+ # METAINTENT_WORKSPACE=
5
+
6
+ # Hard clarify budget before locking intent
7
+ MAX_CLARIFY_ROUNDS=2
8
+
9
+ # --- Backend selection ---
10
+ # ollama = fully local | nim = NVIDIA hosted API (web-friendly)
11
+ PRIMARY_LLM_BACKEND=ollama
12
+ FALLBACK_LLM_BACKEND=ollama
13
+
14
+ # --- Local Ollama ---
15
+ OLLAMA_BASE_URL=http://127.0.0.1:11434
16
+ OLLAMA_TIMEOUT_MS=60000
17
+ OLLAMA_MODEL=qwen2.5-coder:3b
18
+ OLLAMA_MODEL_FAST=qwen2.5-coder:3b
19
+ OLLAMA_MODEL_QUALITY=qwen2.5-coder:7b
20
+ OLLAMA_MODEL_EMBED=nomic-embed-text:latest
21
+
22
+ # --- NVIDIA NIM (OpenAI-compatible) ---
23
+ # Get a key: https://build.nvidia.com/settings
24
+ # Then set:
25
+ # PRIMARY_LLM_BACKEND=nim
26
+ # FALLBACK_LLM_BACKEND=ollama
27
+ NVIDIA_API_KEY=
28
+ NIM_BASE_URL=https://integrate.api.nvidia.com/v1
29
+ NIM_TIMEOUT_MS=90000
30
+ NIM_MODEL=meta/llama-3.1-8b-instruct
31
+ NIM_MODEL_FAST=meta/llama-3.1-8b-instruct
32
+ NIM_MODEL_QUALITY=meta/llama-3.1-70b-instruct
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Md Hammaduddin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,412 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ <h1 align="center">
2
+ <img src="https://raw.githubusercontent.com/Hammaduddin561/MetaIntent/main/docs/icon.png" alt="" width="72" height="72" align="absmiddle" />
3
+ MetaIntent
4
+ </h1>
5
+
6
+ <p align="center">
7
+ <strong>Vague idea → locked intent → project pack on disk</strong><br />
8
+ Clarify ≤2 · lock <code>intent.json</code> · bootstrap Cursor-ready files (Ollama / NVIDIA NIM)
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://www.npmjs.com/package/metaintent"><img src="https://img.shields.io/npm/v/metaintent.svg?style=flat-square" alt="npm" /></a>
13
+ <a href="https://ollama.com"><img src="https://img.shields.io/badge/LLM-Ollama-111111?style=flat-square" alt="Ollama" /></a>
14
+ <a href="https://build.nvidia.com"><img src="https://img.shields.io/badge/LLM-NVIDIA%20NIM-76B900?style=flat-square" alt="NVIDIA NIM" /></a>
15
+ <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/Cursor-MCP-111111?style=flat-square" alt="MCP" /></a>
16
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-5-3178C6?style=flat-square&logo=typescript&logoColor=white" alt="TypeScript" /></a>
17
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-2ea44f?style=flat-square" alt="MIT License" /></a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <a href="#overview"><img src="https://img.shields.io/badge/Overview-111111?style=for-the-badge" alt="Overview" /></a>
22
+ <a href="#screenshots"><img src="https://img.shields.io/badge/Screenshots-212121?style=for-the-badge" alt="Screenshots" /></a>
23
+ <a href="#quick-start"><img src="https://img.shields.io/badge/Quick%20start-111111?style=for-the-badge" alt="Quick start" /></a>
24
+ <a href="#product-loop"><img src="https://img.shields.io/badge/Product%20loop-212121?style=for-the-badge" alt="Product loop" /></a>
25
+ <a href="#architecture"><img src="https://img.shields.io/badge/Architecture-111111?style=for-the-badge" alt="Architecture" /></a>
26
+ <a href="#backends"><img src="https://img.shields.io/badge/Backends-212121?style=for-the-badge" alt="Backends" /></a>
27
+ <a href="#license"><img src="https://img.shields.io/badge/License-2ea44f?style=for-the-badge" alt="License" /></a>
28
+ </p>
29
+
30
+ ## Overview
31
+
32
+ MetaIntent is a **local-first** Intent → Project Bootstrap. Drop a vague idea, answer at most two high-value questions, **lock** an intent contract, then write a real project pack agents can follow — not another chat wrapper.
33
+
34
+ | Capability | What you get |
35
+ |---|---|
36
+ | **Clarify ≤2** | Research-inspired Ask-before-Plan loop, then hard lock |
37
+ | **Locked pack** | `intent.json`, `agent.md`, `week1.md`, `security.md`, `naive-vs-locked.md` |
38
+ | **Cursor rule** | `cursor-rule.md` installed into `.cursor/rules/` |
39
+ | **Surfaces** | npm CLI · Cursor MCP · web demo (`localhost:8787`) |
40
+ | **LLMs** | Ollama (default) or NVIDIA NIM + optional fallback |
41
+
42
+ Default output: **`.metaintent/`** in the workspace (`mode=workspace`).
43
+ Demo packs: `metaintent-projects/<slug>/` (`mode=pack`).
44
+
45
+ ### Why lock intent
46
+
47
+ - Vague goals make agents **guess**; MetaIntent forces a short clarify → lock cycle.
48
+ - The pack is the product: files on disk Cursor / agents can obey.
49
+ - Local-first by default (Ollama). NIM is optional for stronger blueprints / demos.
50
+
51
+ ## Screenshots
52
+
53
+ <table>
54
+ <tr>
55
+ <td width="100%" valign="top">
56
+ <img src="https://raw.githubusercontent.com/Hammaduddin561/MetaIntent/main/docs/screenshots/home.png" alt="Home page" />
57
+ <p align="center"><sub>Home — lock the intent, ship the pack</sub></p>
58
+ </td>
59
+ </tr>
60
+ <tr>
61
+ <td width="100%" valign="top">
62
+ <img src="https://raw.githubusercontent.com/Hammaduddin561/MetaIntent/main/docs/screenshots/chat.png" alt="Demo chat" />
63
+ <p align="center"><sub>Demo chat — ≤2 questions, then bootstrap</sub></p>
64
+ </td>
65
+ </tr>
66
+ </table>
67
+
68
+ ## Quick start
69
+
70
+ **Requirements**
71
+
72
+ | Tool | Notes |
73
+ |---|---|
74
+ | [Node.js 20+](https://nodejs.org/) | CLI, MCP, local server |
75
+ | [Ollama](https://ollama.com) **or** NVIDIA NIM | Local LLM default, or cloud NIM key |
76
+ | Git | Clone / contribute |
77
+ | Cursor (optional) | MCP product path |
78
+
79
+ ### Models (Ollama)
80
+
81
+ ```bash
82
+ ollama pull qwen2.5-coder:3b
83
+ ollama pull qwen2.5-coder:7b
84
+ ```
85
+
86
+ ### Install from npm
87
+
88
+ ```bash
89
+ npx metaintent bootstrap "study planner for exam week" --workspace
90
+ # or
91
+ npm install -g metaintent
92
+ metaintent bootstrap "your idea" --workspace
93
+ ```
94
+
95
+ ### Install from source
96
+
97
+ ```bash
98
+ git clone https://github.com/Hammaduddin561/MetaIntent.git
99
+ cd MetaIntent
100
+ npm install
101
+ copy .env.example .env
102
+ ```
103
+
104
+ ### Cursor MCP (main product)
105
+
106
+ Repo ships `.cursor/mcp.json`. Reload MCP in Cursor, then:
107
+
108
+ 1. Call **`metaintent_bootstrap`** with your idea (`mode` defaults to `workspace`)
109
+ 2. If it returns questions → answer once (or twice) via `answers`
110
+ 3. Open **`.metaintent/`** and follow `intent.json` + `security.md`
111
+
112
+ Other tools: `health` · `start` · `clarify` · `generate` · `execute` · `session`
113
+
114
+ ```bash
115
+ npm run mcp # manual stdio server
116
+ npm run smoke:mcp # tool list + health smoke
117
+ npm run smoke:bootstrap # e2e .metaintent pack on disk
118
+ npm run eval:golden # clarification/lock quality suite
119
+ ```
120
+
121
+ ### CLI (source)
122
+
123
+ ```bash
124
+ npm run cli -- bootstrap "study planner for exam week" --workspace --answers "web, students, 2 weeks, success=weekly plan done"
125
+ ```
126
+
127
+ After `npm run build`, bin is `metaintent` (`package.json` → `dist/cli.js`).
128
+
129
+ ### Web demo
130
+
131
+ ```bash
132
+ npm run local
133
+ ```
134
+
135
+ | Service | URL |
136
+ |---|---|
137
+ | Demo UI + API | http://127.0.0.1:8787/ |
138
+
139
+ Open the install section for copy-paste commands. Serious workflow = MCP / CLI bootstrap.
140
+ Publish notes: [`docs/PUBLISH.md`](docs/PUBLISH.md)
141
+
142
+ ## Product loop
143
+
144
+ ```text
145
+ idea → clarify (≤2) → lock intent → bootstrap files → (optional) execute first task
146
+ ```
147
+
148
+ Hero MCP tool: **`metaintent_bootstrap`**
149
+
150
+ ```mermaid
151
+ flowchart LR
152
+ A[Vague idea] --> B{ClarificationPolicy}
153
+ B -->|clear enough| C[Lock intent.json]
154
+ B -->|≤2 questions| D[User answers]
155
+ D --> B
156
+ B -->|rephrase / budget| C
157
+ C --> E[ProjectBootstrap]
158
+ E --> F[.metaintent pack]
159
+ F --> G[Cursor rule + security.md]
160
+ G --> H[Optional execute first task]
161
+ ```
162
+
163
+ ### Bootstrap pack
164
+
165
+ | File | Purpose |
166
+ |---|---|
167
+ | `intent.json` | Frozen goal, audience, platform, success metric, constraints |
168
+ | `agent.md` | Blueprint (stack, roadmap, system prompt) |
169
+ | `week1.md` | Checklist for v1 |
170
+ | `security.md` | Practical threat-model guardrails |
171
+ | `naive-vs-locked.md` | Proof: naive guess vs locked intent |
172
+ | `cursor-rule.md` | Installed into `.cursor/rules/` to enforce scope |
173
+
174
+ ```mermaid
175
+ flowchart TB
176
+ LOCK[Locked intent] --> WRITE[ProjectBootstrap]
177
+ WRITE --> I[intent.json]
178
+ WRITE --> A[agent.md]
179
+ WRITE --> W[week1.md]
180
+ WRITE --> S[security.md]
181
+ WRITE --> N[naive-vs-locked.md]
182
+ WRITE --> R[cursor-rule.md]
183
+ R --> CR[.cursor/rules/*.mdc]
184
+ ```
185
+
186
+ ## Clarification policy
187
+
188
+ Full citations: [`docs/RESEARCH.md`](docs/RESEARCH.md)
189
+
190
+ | Idea | Paper | Use in MetaIntent |
191
+ |---|---|---|
192
+ | Intent entropy | [Intent-Sim](https://arxiv.org/abs/2311.09469) | Proceed only when a hypothesis dominates |
193
+ | Small set / rephrase | [CICC](https://aclanthology.org/2024.findings-naacl.156/) | ≤2 questions; else rephrase |
194
+ | Ask-before-Plan | [CEP](https://arxiv.org/abs/2406.12639) | Clarify → lock → bootstrap → execute |
195
+ | Split solution space | [Active Task Disambiguation](https://arxiv.org/abs/2502.04485) | Rank slots by solution-split utility |
196
+ | Consistency before code | [ClarifyGPT](https://dl.acm.org/doi/10.1145/3660810) | Dual MVP sketches agree → proceed |
197
+ | Missing variable Qs | [QuestBench](https://arxiv.org/abs/2503.22674) | Prefer the question that unlocks planning |
198
+ | Req defects | [HumanEvalComm](https://dl.acm.org/doi/10.1145/3715109) / [Ambig-SWE](https://arxiv.org/html/2502.13069v2) | Tag incomplete / ambiguous / inconsistent |
199
+
200
+ Hard product rule: **`MAX_CLARIFY_ROUNDS=2`** then lock.
201
+
202
+ ```mermaid
203
+ stateDiagram-v2
204
+ [*] --> Vague
205
+ Vague --> Policy: start / bootstrap
206
+ Policy --> Ask: entropy high / split needed
207
+ Ask --> Policy: answers (round ≤ 2)
208
+ Policy --> Lock: proceed OR max rounds
209
+ Policy --> Rephrase: too diffuse
210
+ Rephrase --> Vague
211
+ Lock --> Pack: write .metaintent
212
+ Pack --> [*]
213
+ ```
214
+
215
+ ## Architecture
216
+
217
+ MetaIntent is a **local-first** Node/TypeScript stack: web demo, npm CLI, and Cursor MCP all hit the same MetaLoop → lock → bootstrap core.
218
+
219
+ ### High-level system
220
+
221
+ ```mermaid
222
+ flowchart TB
223
+ subgraph Surfaces
224
+ WEB[Web demo<br/>frontend + local-server]
225
+ CLI[npm CLI<br/>metaintent bootstrap]
226
+ MCP[Cursor MCP<br/>mcp-server.ts]
227
+ end
228
+
229
+ subgraph Core
230
+ MLB[MetaLoopEngine]
231
+ CP[ClarificationPolicy]
232
+ LI[LockedIntent]
233
+ PB[ProjectBootstrap]
234
+ SG[SecurityGuardrail]
235
+ AG[AgentGenerator]
236
+ end
237
+
238
+ subgraph LLMs
239
+ FAC[LLMAdapterFactory]
240
+ OLL[OllamaAdapter]
241
+ NIM[NIMAdapter]
242
+ end
243
+
244
+ WEB --> MLB
245
+ CLI --> MLB
246
+ MCP --> MLB
247
+ MLB --> CP
248
+ MLB --> LI
249
+ LI --> PB
250
+ PB --> SG
251
+ PB --> AG
252
+ MLB --> FAC
253
+ AG --> FAC
254
+ FAC --> OLL
255
+ FAC --> NIM
256
+ ```
257
+
258
+ ### Runtime surfaces
259
+
260
+ ```mermaid
261
+ flowchart LR
262
+ U[User] --> W[Browser :8787]
263
+ U --> C[npx metaintent]
264
+ U --> K[Cursor IDE]
265
+
266
+ W --> S[local-server.ts]
267
+ C --> CLI[cli.ts]
268
+ K --> M[mcp-server.ts stdio]
269
+
270
+ S --> CORE[MetaLoop + Bootstrap]
271
+ CLI --> CORE
272
+ M --> CORE
273
+ CORE --> DISK[(.metaintent / metaintent-projects)]
274
+ ```
275
+
276
+ ### Layer responsibilities
277
+
278
+ | Layer | Role |
279
+ |---|---|
280
+ | **Frontend (`frontend/`)** | Install-first landing + optional demo chat |
281
+ | **local-server** | HTTP API for demo + health |
282
+ | **cli.ts** | `metaintent bootstrap` entry |
283
+ | **mcp-server.ts** | Cursor MCP tools (bootstrap-first) |
284
+ | **ClarificationPolicy** | ≤2 questions / rephrase / proceed |
285
+ | **ProjectBootstrap** | Writes the `.metaintent` pack + Cursor rule |
286
+ | **SecurityGuardrail** | Practical security notes in the pack |
287
+ | **Adapters** | Ollama + NIM via `LLMAdapterFactory` |
288
+
289
+ ## Backends
290
+
291
+ | Mode | When | Config |
292
+ |---|---|---|
293
+ | **Ollama** (default) | Local / private | `PRIMARY_LLM_BACKEND=ollama` |
294
+ | **NVIDIA NIM** | Web demo / stronger blueprints | `PRIMARY_LLM_BACKEND=nim` + `NVIDIA_API_KEY` |
295
+
296
+ NIM key: [build.nvidia.com/settings](https://build.nvidia.com/settings)
297
+
298
+ Optional fallback: `FALLBACK_LLM_BACKEND=ollama` if NIM fails.
299
+
300
+ ```mermaid
301
+ flowchart LR
302
+ REQ[LLM request] --> F[LLMAdapterFactory]
303
+ F -->|PRIMARY=ollama| O[Ollama]
304
+ F -->|PRIMARY=nim| N[NVIDIA NIM]
305
+ O -->|fail + FALLBACK| N2[Fallback backend]
306
+ N -->|fail + FALLBACK| O2[Fallback backend]
307
+ ```
308
+
309
+ ## API
310
+
311
+ ```bash
312
+ curl http://127.0.0.1:8787/health
313
+
314
+ curl -X POST http://127.0.0.1:8787/metaintent ^
315
+ -H "Content-Type: application/json" ^
316
+ -d "{\"action\":\"bootstrap\",\"input\":\"Study planner for exam week\",\"answers\":\"Web app for students, 2 weeks, success = weekly plan done\"}"
317
+ ```
318
+
319
+ Actions: `bootstrap` · `start` · `clarify` · `generate` · `execute` · `replay` · `intent-map`
320
+
321
+ ```mermaid
322
+ sequenceDiagram
323
+ participant U as Client
324
+ participant S as local-server
325
+ participant M as MetaLoopEngine
326
+ participant P as ProjectBootstrap
327
+ U->>S: POST /metaintent action=bootstrap
328
+ S->>M: clarify / lock
329
+ M-->>S: locked intent OR questions
330
+ alt questions
331
+ S-->>U: clarify (≤2)
332
+ U->>S: answers
333
+ S->>M: continue
334
+ end
335
+ S->>P: write pack
336
+ P-->>S: .metaintent paths
337
+ S-->>U: artifacts + lockedIntent
338
+ ```
339
+
340
+ ## Project layout
341
+
342
+ ```text
343
+ MetaIntent/
344
+ ├── frontend/ # Demo UI (install-first + bootstrap chat)
345
+ ├── src/
346
+ │ ├── cli.ts # metaintent bootstrap CLI
347
+ │ ├── mcp-server.ts # Cursor MCP (bootstrap-first)
348
+ │ ├── local-server.ts # Web + API
349
+ │ ├── adapters/ # Ollama + NIM
350
+ │ └── services/
351
+ │ ├── ClarificationPolicy.ts
352
+ │ ├── MetaLoopEngine.ts
353
+ │ ├── LockedIntent.ts
354
+ │ ├── SecurityGuardrail.ts
355
+ │ ├── ProjectBootstrap.ts
356
+ │ ├── runBootstrap.ts
357
+ │ └── AgentGenerator.ts
358
+ ├── docs/
359
+ │ ├── icon.png # Brand mark (README)
360
+ │ ├── RESEARCH.md
361
+ │ ├── PUBLISH.md
362
+ │ └── screenshots/ # README gallery
363
+ ├── .metaintent/ # Workspace pack (gitignored)
364
+ ├── metaintent-projects/ # Demo packs (gitignored)
365
+ ├── .cursor/mcp.json
366
+ ├── vercel.json
367
+ ├── LICENSE
368
+ └── .env.example
369
+ ```
370
+
371
+ ## Stack
372
+
373
+ | Layer | Tech |
374
+ |---|---|
375
+ | Runtime | Node 20+ · TypeScript |
376
+ | Surfaces | Express local-server · npm CLI · MCP SDK |
377
+ | LLMs | Ollama · NVIDIA NIM |
378
+ | Frontend | Vanilla HTML/CSS/JS (`frontend/`) |
379
+ | Package | [`metaintent` on npm](https://www.npmjs.com/package/metaintent) |
380
+
381
+ ## Troubleshooting
382
+
383
+ | Symptom | Likely fix |
384
+ |---|---|
385
+ | `:8787` connection refused | `npm run local` |
386
+ | Ollama unreachable | `ollama serve` + pull coder models |
387
+ | NIM errors | Set `NVIDIA_API_KEY`; check `PRIMARY_LLM_BACKEND=nim` |
388
+ | MCP tools missing | Reload Cursor MCP; confirm `.cursor/mcp.json` |
389
+ | Empty `.metaintent/` | Run `npm run smoke:bootstrap` or CLI with `--workspace` |
390
+
391
+ ## Contributing
392
+
393
+ 1. Fork + branch from `main`
394
+ 2. `npm install` · `npm run smoke:bootstrap`
395
+ 3. Keep scope inside locked intent when working under `.metaintent/`
396
+ 4. Open a PR with what changed and how you tested
397
+
398
+ ## License
399
+
400
+ This project is licensed under the [MIT License](LICENSE).
401
+
402
+ ```
403
+ MIT License
404
+
405
+ Copyright (c) 2025 Md Hammaduddin
406
+
407
+ Permission is hereby granted, free of charge, to any person obtaining a copy
408
+ of this software and associated documentation files (the "Software"), to deal
409
+ in the Software without restriction...
410
+
411
+ Full terms: see the LICENSE file in this repository.
412
+ ```
@@ -0,0 +1,12 @@
1
+ import { LLMAdapter, LLMBackend } from '../models/types';
2
+ import { ModelRole } from '../models/constants';
3
+ export declare class LLMAdapterFactory {
4
+ private static ollamaByModel;
5
+ private static nimByModel;
6
+ static getAdapter(backend?: LLMBackend, modelOverride?: string): LLMAdapter;
7
+ static getPrimaryAdapter(): LLMAdapter;
8
+ static getFallbackAdapter(): LLMAdapter;
9
+ static getForRole(role: ModelRole, backend?: LLMBackend): LLMAdapter;
10
+ static reset(): void;
11
+ }
12
+ //# sourceMappingURL=LLMAdapterFactory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LLMAdapterFactory.d.ts","sourceRoot":"","sources":["../../src/adapters/LLMAdapterFactory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGzD,OAAO,EAAO,SAAS,EAAuB,MAAM,qBAAqB,CAAC;AAE1E,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAC,aAAa,CAAoC;IAChE,OAAO,CAAC,MAAM,CAAC,UAAU,CAAiC;IAE1D,MAAM,CAAC,UAAU,CAAC,OAAO,GAAE,UAAoC,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,UAAU;IAoBpG,MAAM,CAAC,iBAAiB,IAAI,UAAU;IAItC,MAAM,CAAC,kBAAkB,IAAI,UAAU;IAIvC,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAE,UAAoC,GAAG,UAAU;IAI7F,MAAM,CAAC,KAAK,IAAI,IAAI;CAIrB"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ // Adapter factory: local Ollama + NVIDIA NIM
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.LLMAdapterFactory = void 0;
5
+ const OllamaAdapter_1 = require("./OllamaAdapter");
6
+ const NIMAdapter_1 = require("./NIMAdapter");
7
+ const constants_1 = require("../models/constants");
8
+ class LLMAdapterFactory {
9
+ static ollamaByModel = new Map();
10
+ static nimByModel = new Map();
11
+ static getAdapter(backend = constants_1.ENV.PRIMARY_LLM_BACKEND, modelOverride) {
12
+ if (backend === 'nim') {
13
+ const model = modelOverride || constants_1.ENV.NIM_MODEL;
14
+ let instance = this.nimByModel.get(model);
15
+ if (!instance) {
16
+ instance = new NIMAdapter_1.NIMAdapter(model, constants_1.ENV.NIM_BASE_URL, constants_1.ENV.NVIDIA_API_KEY);
17
+ this.nimByModel.set(model, instance);
18
+ }
19
+ return instance;
20
+ }
21
+ const model = modelOverride || constants_1.ENV.OLLAMA_MODEL;
22
+ let instance = this.ollamaByModel.get(model);
23
+ if (!instance) {
24
+ instance = new OllamaAdapter_1.OllamaAdapter(model, constants_1.ENV.OLLAMA_BASE_URL);
25
+ this.ollamaByModel.set(model, instance);
26
+ }
27
+ return instance;
28
+ }
29
+ static getPrimaryAdapter() {
30
+ return this.getAdapter(constants_1.ENV.PRIMARY_LLM_BACKEND);
31
+ }
32
+ static getFallbackAdapter() {
33
+ return this.getAdapter(constants_1.ENV.FALLBACK_LLM_BACKEND, (0, constants_1.resolveModelForRole)('fast', constants_1.ENV.FALLBACK_LLM_BACKEND));
34
+ }
35
+ static getForRole(role, backend = constants_1.ENV.PRIMARY_LLM_BACKEND) {
36
+ return this.getAdapter(backend, (0, constants_1.resolveModelForRole)(role, backend));
37
+ }
38
+ static reset() {
39
+ this.ollamaByModel.clear();
40
+ this.nimByModel.clear();
41
+ }
42
+ }
43
+ exports.LLMAdapterFactory = LLMAdapterFactory;
44
+ //# sourceMappingURL=LLMAdapterFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LLMAdapterFactory.js","sourceRoot":"","sources":["../../src/adapters/LLMAdapterFactory.ts"],"names":[],"mappings":";AAAA,6CAA6C;;;AAG7C,mDAAgD;AAChD,6CAA0C;AAC1C,mDAA0E;AAE1E,MAAa,iBAAiB;IACpB,MAAM,CAAC,aAAa,GAAG,IAAI,GAAG,EAAyB,CAAC;IACxD,MAAM,CAAC,UAAU,GAAG,IAAI,GAAG,EAAsB,CAAC;IAE1D,MAAM,CAAC,UAAU,CAAC,UAAsB,eAAG,CAAC,mBAAmB,EAAE,aAAsB;QACrF,IAAI,OAAO,KAAK,KAAK,EAAE,CAAC;YACtB,MAAM,KAAK,GAAG,aAAa,IAAI,eAAG,CAAC,SAAS,CAAC;YAC7C,IAAI,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC1C,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,QAAQ,GAAG,IAAI,uBAAU,CAAC,KAAK,EAAE,eAAG,CAAC,YAAY,EAAE,eAAG,CAAC,cAAc,CAAC,CAAC;gBACvE,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YACvC,CAAC;YACD,OAAO,QAAQ,CAAC;QAClB,CAAC;QAED,MAAM,KAAK,GAAG,aAAa,IAAI,eAAG,CAAC,YAAY,CAAC;QAChD,IAAI,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,QAAQ,GAAG,IAAI,6BAAa,CAAC,KAAK,EAAE,eAAG,CAAC,eAAe,CAAC,CAAC;YACzD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAC1C,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,iBAAiB;QACtB,OAAO,IAAI,CAAC,UAAU,CAAC,eAAG,CAAC,mBAAmB,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,CAAC,kBAAkB;QACvB,OAAO,IAAI,CAAC,UAAU,CAAC,eAAG,CAAC,oBAAoB,EAAE,IAAA,+BAAmB,EAAC,MAAM,EAAE,eAAG,CAAC,oBAAoB,CAAC,CAAC,CAAC;IAC1G,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,IAAe,EAAE,UAAsB,eAAG,CAAC,mBAAmB;QAC9E,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,IAAA,+BAAmB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,MAAM,CAAC,KAAK;QACV,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;IAC1B,CAAC;;AAvCH,8CAwCC"}
@@ -0,0 +1,15 @@
1
+ import { LLMAdapter, LLMConfig, LLMResponse } from '../models/types';
2
+ export declare class NIMAdapter implements LLMAdapter {
3
+ private model;
4
+ private baseUrl;
5
+ private apiKey;
6
+ constructor(model?: string, baseUrl?: string, apiKey?: string);
7
+ invoke(prompt: string, config: LLMConfig): Promise<LLMResponse>;
8
+ invokeWithRetry(prompt: string, config: LLMConfig, retries: number): Promise<LLMResponse>;
9
+ estimateCost(_prompt: string, _config: LLMConfig): number;
10
+ private stripThinking;
11
+ private estimateTokens;
12
+ private handleHttpError;
13
+ private handleError;
14
+ }
15
+ //# sourceMappingURL=NIMAdapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NIMAdapter.d.ts","sourceRoot":"","sources":["../../src/adapters/NIMAdapter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAQrE,qBAAa,UAAW,YAAW,UAAU;IAEzC,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,OAAO;IACf,OAAO,CAAC,MAAM;gBAFN,KAAK,GAAE,MAAsB,EAC7B,OAAO,GAAE,MAAyB,EAClC,MAAM,GAAE,MAA2B;IAGvC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IA0E/D,eAAe,CACnB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,WAAW,CAAC;IAmBvB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,GAAG,MAAM;IAIzD,OAAO,CAAC,aAAa;IAOrB,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,WAAW;CAYpB"}