Mentu

Quick Start

Quick Start

This guide walks you through creating and running your first mentu script.

Prerequisites

  • mentu CLI installed (mentu --version prints output)
  • Node.js 20+ installed (node --version)

Create your first script

Create a file at ~/.mentu/scripts/hello.ts:

const name = mentu.vars.NAME ?? 'world';
const stats = mentu.cir.stats();
 
console.log(`Hello, ${name}!`);
console.log(`CIR: ${stats.signals} signals, ${stats.contradictions} contradictions`);
 
return { greeting: `Hello, ${name}!`, stats };

Run it

mentu script run hello --var NAME=developer

Expected output

Hello, developer!
CIR: 1432 signals, 3 contradictions
{
  "greeting": "Hello, developer!",
  "stats": {
    "signals": 1432,
    "relations": 287,
    "embeddings": 956,
    "patterns": 41,
    "contradictions": 3,
    "database_size_bytes": 4218904
  }
}

Console output (console.log) prints first, followed by the return value serialized as JSON.

What happened

  1. The CLI resolved hello to ~/.mentu/scripts/hello.ts
  2. Node.js spawned a V8 sandbox with the mentu SDK injected as a global
  3. mentu.vars.NAME read the --var NAME=developer argument
  4. mentu.cir.stats() shelled out to mentu cir stats --format json and returned the parsed result
  5. Console output and the return value were printed to stdout

List available scripts

mentu script list

This searches both {workspace}/.mentu/scripts/ and ~/.mentu/scripts/ and displays all discovered scripts.

Next steps

  • Query CIR signalsmentu.cir.query({ type: 'observation', limit: 10 })
  • Read a secretmentu.vault.get('MY_API_KEY')
  • Check system healthmentu.health.check()
  • Send a notificationmentu.notify.send('Alert', 'Something happened')

See the SDK Reference for the complete API.

© 2026 Mentu.