micro-models-agent 0.18.3 → 0.19.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.
@@ -34,10 +34,9 @@ function buildSystemInfo(config, baseDir, profileCompressed) {
34
34
  `Workspace: ${baseDir}`,
35
35
  `${profileCompressed}`,
36
36
  `Reply in the user's language. Use tools for filesystem, bash, web access.`,
37
- `When you need to act, call a tool immediately. Do not describe your plans in text use tools to perform operations.`,
38
- `After every tool call, check whether the user's request is fully satisfied. If any files, commands, or checks are still missing, call the next needed tool right away. Do not stop with an empty or "done" response until the task is complete.`,
39
- `If you create a directory, continue creating the files that belong inside it. A created folder alone is not a completed task.`,
40
- `If a tool call fails (e.g., a skill is too large), try an alternative approach or continue without it. Do not reply with empty text when the task is unfinished.`,
37
+ `Use tools when needed. Explain briefly what you're doing if it's not obvious.`,
38
+ `Answer the user's question directly. Only take action when the user explicitly asks you to change, create, or fix something.`,
39
+ `If a tool call fails, report the error and ask the user how to proceed.`,
41
40
  ``,
42
41
  `Design principles — apply them automatically without naming them:`,
43
42
  `- Do not add code, files, or abstractions that are not needed right now (YAGNI — You Ain't Gonna Need It). If something is not required by the current task, omit it.`,
@@ -49,7 +48,7 @@ function buildSystemInfo(config, baseDir, profileCompressed) {
49
48
  }
50
49
  lines.push(``, `Bash tool rules:`, `- Use the "workdir" parameter to run commands in a specific directory. Do NOT chain "cd dir && cmd" — the security module blocks the "&&" operator.`, `- Run one command per tool call. Split multi-step shell operations into separate bash calls.`);
51
50
  if (config.autoPlan) {
52
- lines.push(``, `Plan rule: For any task with 2+ steps, create a plan first using the "plan" tool. After each step, call "plan update" to mark progress. Stay focused on the current step.`);
51
+ lines.push(``, `Plan rule: For complex tasks with 3+ steps, you may create a plan using the "plan" tool. For simple questions, just answer directly.`);
53
52
  }
54
53
  const hasMCP = config.mcpServers &&
55
54
  Object.values(config.mcpServers).some((s) => s.enabled !== false);
@@ -187,12 +186,6 @@ export async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplet
187
186
  toolCtx.llmProvider = llmProvider;
188
187
  toolCtx.toolExecutor = toolExecutor;
189
188
  const hallucinationDetector = new HallucinationDetector();
190
- const factualCheck = hallucinationDetector.getFactualCheck();
191
- factualCheck.setBaseDir(baseDir);
192
- toolCtx.trackReadPath = (p) => factualCheck.trackReadPath(p);
193
- toolCtx.trackCreatedPath = (p) => factualCheck.trackCreatedPath(p);
194
- toolCtx.trackDeletedPath = (p) => factualCheck.trackDeletedPath(p);
195
- toolCtx.trackDocumentContent = (c) => factualCheck.trackDocumentContent(c);
196
189
  const moduleRegistry = new ModuleRegistry();
197
190
  const execModule = new ExecutionModule(baseDir, config.stuckThreshold);
198
191
  moduleRegistry.register(execModule);
@@ -203,7 +196,7 @@ export async function bootstrap(configDir, projectDir, noAgentsMd, exitOnComplet
203
196
  const mcpModule = new MCPModule(config);
204
197
  await mcpModule.initialize();
205
198
  moduleRegistry.register(mcpModule);
206
- const memoryModule = new MemoryModule(join(dir, 'memory'));
199
+ const memoryModule = new MemoryModule(join(dir, "memory"));
207
200
  moduleRegistry.register(memoryModule);
208
201
  if (config.browser.enabled) {
209
202
  const browserModule = new BrowserModule();
@@ -30,14 +30,19 @@ export class ConfidenceCheck {
30
30
  }
31
31
  }
32
32
  // Language-agnostic: very low word diversity (same words repeated)
33
- const words = response.toLowerCase().split(/\s+/).filter(w => w.length > 2);
33
+ const words = response
34
+ .toLowerCase()
35
+ .split(/\s+/)
36
+ .filter((w) => w.length > 2);
34
37
  if (words.length >= 10) {
35
38
  const unique = new Set(words);
36
39
  const diversity = unique.size / words.length;
37
40
  if (diversity < 0.25) {
38
41
  return {
39
42
  status: "warn",
40
- reason: t("hall.repetitive", { pct: Math.round((1 - diversity) * 100) }),
43
+ reason: t("hall.repetitive", {
44
+ pct: Math.round((1 - diversity) * 100),
45
+ }),
41
46
  };
42
47
  }
43
48
  }
@@ -1,4 +1,4 @@
1
- import { t } from '../../i18n/index';
1
+ import { t } from "../../i18n/index";
2
2
  export class ConsistencyCheck {
3
3
  decisions = [];
4
4
  createdFiles = new Set();
@@ -18,8 +18,11 @@ export class ConsistencyCheck {
18
18
  validate(response) {
19
19
  const lower = response.toLowerCase();
20
20
  for (const d of this.decisions) {
21
- const decisionWords = d.decision.toLowerCase().split(/\s+/).filter(w => w.length > 3);
22
- const contradicts = decisionWords.some(word => {
21
+ const decisionWords = d.decision
22
+ .toLowerCase()
23
+ .split(/\s+/)
24
+ .filter((w) => w.length > 3);
25
+ const contradicts = decisionWords.some((word) => {
23
26
  // English patterns
24
27
  if (lower.includes(`instead of ${word}`))
25
28
  return true;
@@ -50,11 +53,14 @@ export class ConsistencyCheck {
50
53
  });
51
54
  if (contradicts) {
52
55
  return {
53
- status: 'warn',
54
- reason: t('hall.contradiction', { decision: d.decision, location: d.location }),
56
+ status: "warn",
57
+ reason: t("hall.contradiction", {
58
+ decision: d.decision,
59
+ location: d.location,
60
+ }),
55
61
  };
56
62
  }
57
63
  }
58
- return { status: 'pass' };
64
+ return { status: "pass" };
59
65
  }
60
66
  }
@@ -1,18 +1,12 @@
1
- import { FactualCheck } from './factual';
2
- import { ConsistencyCheck } from './consistency';
3
- import { ConfidenceCheck } from './confidence';
1
+ import { ConsistencyCheck } from "./consistency";
2
+ import { ConfidenceCheck } from "./confidence";
4
3
  export class HallucinationDetector {
5
- factual;
6
4
  consistency;
7
5
  confidence;
8
6
  constructor() {
9
- this.factual = new FactualCheck();
10
7
  this.consistency = new ConsistencyCheck();
11
8
  this.confidence = new ConfidenceCheck();
12
9
  }
13
- getFactualCheck() {
14
- return this.factual;
15
- }
16
10
  getConsistencyCheck() {
17
11
  return this.consistency;
18
12
  }
@@ -21,21 +15,19 @@ export class HallucinationDetector {
21
15
  }
22
16
  validate(response) {
23
17
  const confidenceResult = this.confidence.validate(response);
24
- if (confidenceResult.status === 'retry' || confidenceResult.status === 'block') {
18
+ if (confidenceResult.status === "retry" ||
19
+ confidenceResult.status === "block") {
25
20
  return confidenceResult;
26
21
  }
27
- const factualResult = this.factual.validate(response);
28
22
  const consistencyResult = this.consistency.validate(response);
29
23
  const warnings = [];
30
- if (factualResult.status === 'warn')
31
- warnings.push(factualResult.reason || '');
32
- if (consistencyResult.status === 'warn')
33
- warnings.push(consistencyResult.reason || '');
34
- if (confidenceResult.status === 'warn')
35
- warnings.push(confidenceResult.reason || '');
24
+ if (consistencyResult.status === "warn")
25
+ warnings.push(consistencyResult.reason || "");
26
+ if (confidenceResult.status === "warn")
27
+ warnings.push(confidenceResult.reason || "");
36
28
  if (warnings.length > 0) {
37
- return { status: 'warn', reason: warnings.join('; ') };
29
+ return { status: "warn", reason: warnings.join("; ") };
38
30
  }
39
- return { status: 'pass' };
31
+ return { status: "pass" };
40
32
  }
41
33
  }
@@ -1,4 +1,3 @@
1
- export { HallucinationDetector } from './detector';
2
- export { FactualCheck } from './factual';
3
- export { ConsistencyCheck } from './consistency';
4
- export { ConfidenceCheck } from './confidence';
1
+ export { HallucinationDetector, } from "./detector";
2
+ export { ConsistencyCheck } from "./consistency";
3
+ export { ConfidenceCheck } from "./confidence";
@@ -50,7 +50,6 @@ export const createDirTool = {
50
50
  ctx.fileOperationsCount = currentCount + 1;
51
51
  // Log directory creation
52
52
  logFileWrite(ctx.sessionId, path, true, "Directory created");
53
- ctx.trackCreatedPath?.(path);
54
53
  return { success: true, output: t("file.created", { path }) };
55
54
  },
56
55
  };
@@ -57,7 +57,6 @@ export const deleteFileTool = {
57
57
  ctx.fileOperationsCount = currentCount + 1;
58
58
  // Log successful file deletion
59
59
  logFileDelete(ctx.sessionId, path, true);
60
- ctx.trackDeletedPath?.(path);
61
60
  return { success: true, output: t("file.deleted", { path }), diff };
62
61
  },
63
62
  };
@@ -44,10 +44,7 @@ export const readFileTool = {
44
44
  if (!existsSync(resolved)) {
45
45
  return { success: false, output: t("file.notfound", { path }) };
46
46
  }
47
- ctx.trackReadPath?.(path);
48
47
  const content = readFileSync(resolved, "utf-8");
49
- // Track file paths mentioned in the document (e.g. structure.md, README)
50
- ctx.trackDocumentContent?.(content);
51
48
  const lines = content.split("\n");
52
49
  const total = lines.length;
53
50
  const offset = args.offset || 1;
@@ -73,8 +73,7 @@ export const writeFileTool = {
73
73
  // Increment file operations counter
74
74
  ctx.fileOperationsCount = currentCount + 1;
75
75
  // Log successful file write
76
- logFileWrite(ctx.sessionId, path, true, `File ${fileExists ? 'updated' : 'created'}`);
77
- ctx.trackCreatedPath?.(path);
76
+ logFileWrite(ctx.sessionId, path, true, `File ${fileExists ? "updated" : "created"}`);
78
77
  return { success: true, output: t("file.written", { path }), diff };
79
78
  },
80
79
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "micro-models-agent",
3
- "version": "0.18.3",
3
+ "version": "0.19.1",
4
4
  "description": "Micro Models Agent (MMA) — LLM agent harness for small models (Qwen3.5-9B, 32K-64K context)",
5
5
  "type": "module",
6
6
  "bin": {