Skip to content

ParaharnessDeclarative Multi-Agent Orchestration for TypeScript

Compile agents, tools, policies, and flows into a pure passive AST. Execute them durably across isolated scopes, model pools, and human escalations.

Quick Start ​

Install the core DSL and runtime along with your chosen model, scope, and ledger drivers:

bash
npm install @paraharness/core @paraharness/claude @paraharness/fs @paraharness/git @paraharness/node @paraharness/sqlite zod

Declare an agent, mount it inside an isolated Copy-on-Write Git worktree flow, and start the durable runtime:

ts
import { P, z } from '@paraharness/core';
import { createRuntime, runFlow, runStep } from '@paraharness/core/runtime';
import { claude, claudeExecutors } from '@paraharness/claude';
import { fs, fsExecutors } from '@paraharness/fs';
import { git, gitExecutors } from '@paraharness/git';
import { local, nodeExecutors } from '@paraharness/node';
import { sqlite, sqliteExecutors } from '@paraharness/sqlite';

const TaskInput = z.object({
  taskId: z.string(),
  prompt: z.string(),
});

const runner = local.runner({ slots: 4, maxDaemons: 2 });
const sonnet = claude.model('claude-sonnet-4-6');

const verifySuite = local
  .streamCheck('verify-suite')
  .runner(runner)
  .argv(['pnpm', 'test', '--run'])
  .circuitBreakWhenStdout(/FAIL/);

const worker = P.agent('worker')
  .model(sonnet)
  .tools(fs.codingTools(), verifySuite.asTool())
  .instructions('Implement the requested change and keep all checks passing.')
  .beforeStop(verifySuite)
  .input(TaskInput)
  .output(z.object({ summary: z.string() }));

const stepOut = await runStep(
  worker,
  { taskId: 'task-1', prompt: 'Add input validation' },
  {
    registry: [claudeExecutors, fsExecutors, nodeExecutors],
    env: process.env,
  },
);

const deliveryFlow = P.flow('delivery-flow')
  .input(TaskInput)
  .scope(git.cowWorktree())
  .step('implement', worker)
  .exit('done');

const flowResult = await runFlow(
  deliveryFlow,
  { taskId: 'task-1', prompt: 'Add input validation' },
  {
    registry: [claudeExecutors, fsExecutors, gitExecutors, nodeExecutors, sqliteExecutors],
    ledger: sqlite.ledger('.harness/state.sqlite'),
    env: process.env,
  },
);

const harness = P.harness('engineering-harness')
  .ledger(sqlite.ledger('.harness/state.sqlite'))
  .pools(runner)
  .lanes(
    P.lane('main-lane')
      .input(TaskInput)
      .key((item) => item.taskId)
      .runs(deliveryFlow)
      .concurrency(2)
      .priority('normal'),
  );

const runtime = createRuntime(harness, {
  registry: [claudeExecutors, fsExecutors, gitExecutors, nodeExecutors, sqliteExecutors],
  env: process.env,
});
await runtime.start();

Released under the MIT License.