Personal Assistant from Config

medium15 minsuper-assistant.ts

You want a personal assistant with memory, web search and a scheduler, reachable from the terminal and Telegram — configured, not coded.

What it shows

  • Validate a config with AssistantConfigSchema
  • Build the runtime, gateway and tools with RuntimeBuilder

The code

super-assistant.ts
import { AssistantConfigSchema, RuntimeBuilder } from '@cogitator-ai/channels';

const ownerId = process.env.OWNER_TG_ID;

const config = AssistantConfigSchema.parse({
  name: 'jarvis',
  personality: `You are Jarvis, a personal AI assistant.
Be concise, friendly and proactive. Remember important things using memory tools.`,
  llm: { provider: 'google', model: 'google/gemini-3.5-flash-lite' },
  channels: process.env.TG_TOKEN ? { telegram: { ownerIds: ownerId ? [ownerId] : [] } } : {},
  capabilities: { webSearch: true, scheduler: true },
  memory: {
    adapter: 'sqlite',
    path: '~/.cogitator/memory.db',
    knowledgeGraph: true,
    autoExtract: true,
    compaction: { threshold: 50 },
  },
  security: { dmPolicy: ownerId ? 'pairing' : 'open' },
});

const runtime = await new RuntimeBuilder(config, process.env).build();
await runtime.gateway.start();
console.log(`${config.name} is running — chat in the terminal, or on Telegram if TG_TOKEN is set.`);

process.on('SIGINT', async () => {
  await runtime.cleanup();
  process.exit(0);
});

Run it

install · bash
pnpm add @cogitator-ai/channels grammy better-sqlite3
EnvironmentGOOGLE_API_KEYTG_TOKEN (optional)OWNER_TG_ID (optional)
run · bash
GOOGLE_API_KEY=your-key npx tsx super-assistant.ts

Or run the full example from a clone of the repository (keys in .env):

repository · bash
npx tsx examples/channels/02-super-assistant.ts

Learn more