Lines 1-72javascript
3 * artifakt -> start the Artifakt web app (embedded PGlite, zero install)
4 * artifakt mcp -> run the MCP stdio server (your AI app spawns this)
5 * artifakt setup claude -> register Artifakt with Claude Desktop
6 * artifakt setup claude-code -> install the artifakt-review skill + print the connect command
7 * artifakt setup codex -> register Artifakt with Codex (+ drop the playbook)
8 * artifakt status -> what's under review from THIS project (the resume pointer)
9 * artifakt pair -> pair THIS computer to a workspace (browser approval;
10 * credential lands in ~/.artifakt/runner.json, no paste)
12 * LOCAL by default (the OSS zero-install loop — Decision 006/008). Cloud is opt-in by
13 * SIGNAL, not a flipped default: pass --token (mint one in Settings → Access tokens),
14 * optionally --url (defaults to the hosted app), or set ARTIFAKT_TOKEN. The cloud web app's
15 * "Connect your agent" page emits these commands for you. (First-time UX — Decision 022)
17import { spawn, spawnSync } from "node:child_process";
18import { fileURLToPath } from "node:url";
19import { dirname, join } from "node:path";
20import { homedir, hostname, platform } from "node:os";
21import { detectAgents, resolveWorkerTemplate } from "./agent-templates.mjs";
32const __dirname = dirname(fileURLToPath(import.meta.url));
33const root = join(__dirname, "..");
34const cmd = process.argv[2] ?? "start";
36// Paired-runner credential (artifakt pair): saved once per machine, then every
37// daemon on this computer authenticates without a token paste.
38const RUNNER_CONFIG = join(homedir(), ".artifakt", "runner.json");
39function loadRunnerConfig() {
41 return JSON.parse(readFileSync(RUNNER_CONFIG, "utf8"));
47// Local notification channel (the resident lane): `artifakt listen --local` drops
48// one envelope file per undelivered round here; `artifakt wait-local` blocks on the
49// directory, prints the envelope, and consumes it. The file IS the handshake —
50// present = undelivered, gone = a session took it. Zero model tokens while idle
53 process.env.ARTIFAKT_NOTIFY_DIR ?? join(homedir(), ".artifakt", "notifications");
54function envelopePath(artifactId) {
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
bin/artifakt.mjsView on unpkg · L16 55 return join(NOTIFY_DIR, `${artifactId}.json`);
58const DEFAULT_CLOUD_URL = "https://app.artifakthq.com/api/mcp";
60function run(command, args, opts = {}) {
61 const child = spawn(command, args, {
62 cwd: root,
HighSame File Env Network Execution
A single source file combines environment access, network access, and code or shell execution; review context before blocking.
bin/artifakt.mjsView on unpkg · L52 64 shell: process.platform === "win32",
67 child.on("exit", (code) => process.exit(code ?? 0));
70// Resolve local-vs-cloud from the signal: a token (flag or ARTIFAKT_TOKEN), --url, or
71// --cloud all mean cloud. Cloud needs a token; bail clearly if it's missing.
72function resolveTarget(args) {