Superego

Profiles

A profile is what an agent is: a folder with a profile.ts, and whatever files it names.

Where Whose Runs
~/.superego/profiles/<name>/ yours, for every folder on this machine always
<source>/profiles/<name>/ yours, from a profile source you installed (see below) always
<project>/.superego/profiles/<name>/ the project's, for threads in it and below (up to its repository's top) once allowed

A thread takes its profile when it starts and keeps it. Without -P, it gets the profile called default: the project's if there is one, else yours, else none (plain Superego). A project's profile of a name replaces yours of that name, unless it extends it.

superego profile new support           # scaffolds .superego/profiles/support/profile.ts here, and allows it
superego profile new --user            # ~/.superego/profiles/default
superego profile types                 # types for this project's profiles that were there already (--user: yours)
superego -P support -p "Order 1234?"   # a thread with it

profile.ts

import { defineProfile } from 'superego'

export default defineProfile({
  description: 'Answers customer mail',              // shown where a profile is picked
  model: 'anthropic/claude-sonnet-4-5',              // provider/model; else the machine's default
  thinking: 'medium',
  // agent: 'claude-agent',                          // another kind of agent, for its threads' whole life (below)
  prompt: 'You answer customer email for Acme. Be brief.',
  extensions: ['./orders.ts'],                       // daemon side: see below
  ui: ['./ui/order.tsx'],                            // window side: defineUiExtension modules
  panes: {                                           // pane kinds its UI adds, listed to the agent for pane_open
    order: 'an order, with its lines and status. Params: { id }',
  },
  without: ['agent-ui'],                             // built-ins to leave out
  options: { worktrees: true },                      // what its threads ask extensions for, by name: a worktree each
  extends: 'user:default',                           // start from your profile of that name, and add to it
  // global: true,                                   // yours only: part of the app, not only of its threads (below)
  mcpServers: [                                      // the mcp-servers extension's key: MCP servers its threads use
    'linear',                                        // the machine's, by name
    { docs: { command: 'node', args: ['./tools/docs-mcp.js'], auth: { type: 'env', names: ['DOCS_TOKEN'] } } },  // its own
  ],
})

Global profiles. global: true makes one of your own profiles part of the app, not only of its threads: the daemon loads it as it starts (its daemon halves run for the daemon's life, whatever threads there are), and the window installs its UI as the app's: its views go in any place (a sidebar in the rail), its slots and tool rows apply to every thread, its styles are the window's, and it can add spaces (views that fill the main area, with a thread docked beside them: superego --skill window). A Notes app or a canvas is a global profile. A project's profile can't be global (it's told so in its problems), and a profile extending a global one isn't global unless it says so itself.

Every field is optional, and no other is taken: a misspelt key, or one that's gone, fails the type check. A profile that loads with one anyway (a key no extension here reads, a without naming no extension) is told so on its card (the profile's name in the title bar) and in profile.list's problems.

Profile files are TypeScript (the daemon strips the types as it loads them) or JavaScript. They may import each other and Node's built-ins (node:fs/promises, …). 'superego' is the only package they get (and 'superego/ui' and 'react' in UI modules); there is no npm install. Anything else imported by name, a package or a # alias from a package.json, is refused, and the profile doesn't load: what it would run is resolved by what's around the profile, outside what allowing it vouches for. A file imported by its path is fine wherever it is (node_modules too), and is part of what's allowed.

Types

superego profile new (and extension new) gives the profile what an editor needs to check it; superego profile types [name] gives it to profiles that were there before (all of this project's, the one named, or yours with --user), and again after a fresh clone:

The daemon doesn't load packages from node_modules, and neither it nor the .gitignore counts toward a project profile's allowance; the tsconfig.json does, so profile types allows again a profile that was allowed. superego extension test checks types with the same tsconfig before it runs the tests.

What 'superego' exports

import {
  defineProfile,                                     // profile.ts
  defineExtension, defineTool, section,              // agent parts
  wrapTool, wrapSection, hook,                       // decorating other extensions' tools and sections
  defineDaemonExtension, defineAction, RpcError, spawnGroup,   // daemon halves (`runs: 'machine'` is implied)
  obj, str, num, int, bool, arr, opt, lit, union, nullable, unknown,   // JSON Schema for parameters
} from 'superego'

Profile sources

Your profiles can live in a repo or folder of their own, installed as a source the way Pi installs packages. A source is a git repo, git:<host>/<owner>/<repo>[@ref] (an https:// URL works too), cloned to ~/.superego/sources/<host>/<owner>/<repo>, or a folder, ~/… or absolute (a path from here, from the command line), read in place. Its profiles are its profiles/<name>/profile.ts.

superego profile install git:github.com/mikker/superego-profiles   # clone it; again, nothing changes
superego profile install ~/dev/superego-profiles                    # a checkout of it, read in place
superego profile install git:github.com/acme/profiles@v1.2          # pinned: a tag, branch or commit
superego profile sources                                            # each source, its state and its profiles
superego profile update [source]                                    # git pull --ff-only (pinned ones stay)
superego profile remove <source>                                    # drop it; a git one's clone is deleted

Their profiles are yours: they run without being allowed, like those in ~/.superego/profiles, so installing a source is trusting its code, and an agent can't install one for the user. extends: 'user:<name>', -P <name> --user and profile types --user find them by name like any of yours.

Yours are looked for in ~/.superego/profiles first, then each source in the order installed: of two of one name, the first is used, and the other is told of as shadowed (superego profile, profile sources, Settings → Profiles). The list is ~/.superego/profile-sources.json ({ "sources": [...] }); edited by hand, it's read again, and profile update clones a git source it lists that isn't cloned yet. A source's edits (or a pull) apply as any of your profiles' do: from each thread's next turn.

Allowing

A project's profile runs code from that repository, so the daemon refuses it until it is allowed, and again whenever any file it runs changes: any file in its folder (node_modules and dotfiles aside), and every file its code imports, wherever it is:

superego profile allow support     # in the project

superego profile new allows what it scaffolds; after you edit a project's profile yourself, allow it again. Your own profiles in ~/.superego/profiles are never asked about.

Allowing is the user's consent, never an agent's: run in a thread's shell, profile allow (and allow-ui) is refused, and profile new and extension new leave a project's profile waiting. An agent that made or changed one tells the user to allow it: in the window (where its thread asks, or Settings → Profiles), or in their own terminal.

A profile's UI from another machine is asked about on this computer too, since it runs in the window with reach to every machine: once for exactly the sources the window received, again after any change. Allow it from the notice in one of its threads, or:

superego profile allow-ui default -m box     # as it is now; a name, or the profile's folder there
superego profile revoke-ui default -m box    # Settings → Machines lists them too, with Revoke

When changes apply

An example

examples/build-queue-ui is a complete one: a tool, a scoped value per thread, a Cancel action, a view of its own beside the thread, and tests. Read it for a working pattern.

A minimal one with a tool:

// .superego/profiles/support/profile.ts
import { defineProfile } from 'superego'
export default defineProfile({ prompt: 'Answer customers. Look orders up before answering.', extensions: ['./orders.ts'] })
// .superego/profiles/support/orders.ts
import { defineExtension, defineTool, obj, str } from 'superego'

export default defineExtension({
  name: 'orders',
  tools: [defineTool({
    name: 'find_order',
    description: 'Find an order by its number.',
    parameters: obj({ number: str() }),
    async execute({ number }) {
      const order = await fetch(`https://acme.example/orders/${number}`).then((r) => r.json())
      return { output: [{ type: 'text', text: JSON.stringify(order) }] }
    },
  })],
})

packages/cli/skill/profiles.md