Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0sec labs 0 runUnified

From Leeroopedia
Knowledge Sources
Domains Source_Code_Review, Agent_Loop, Security
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete tool for the unified run command that drives the LLM agent loop for source code review, scan, and audit, provided by the 0security CLI package.

Description

The runUnified function is the shared entrypoint for review, scan, and audit commands. It loads the core engine (@0/core), builds a ScanPlan, drives the agent loop (agenticScan), persists findings to SQLite (@0/db), and formats the output. It supports reviewStrategy ("pipeline" or "lenses"), timeout (AI agent timeout), costCeilingUsd (hard USD cost ceiling), and hypothesis (operator research direction seed).

Usage

Import this when you need to run the core analysis engine programmatically. It is used by the review, scan, and audit CLI commands (Step 3 of source code review, and also referenced by Steps 1 and 2).

Code Reference

Source Location

  • Repository: 0security
  • File: packages/cli/src/commands/run.ts:L443-700+

Signature

export async function runUnified(opts: RunOptions): Promise<void>;

Import

import { runUnified } from "./commands/run.js";

I/O Contract

Inputs

Name Type Required Description
opts.repo string Yes /// Local path or git URL to review
opts.profile ReviewProfile Yes /// Review profile (default, c-library, linux-kernel, ...)
opts.depth ScanDepth Yes /// Review depth (quick, default, deep)
opts.runtime RuntimeMode Yes /// LLM runtime (auto, claude, codex, gemini, api, ollama)
opts.timeout number No /// AI agent timeout in ms
opts.costCeilingUsd number No /// Hard USD cost ceiling
opts.seedFindings SeedFinding[] No /// External leads merged into pipeline

Outputs

Name Type Description
return Promise<void> /// Side effect: findings written to DB and formatted per --format

Usage Examples

Programmatic invocation

import { runUnified } from "./commands/run.js";

await runUnified({
  repo: "./my-repo",
  profile: "default",
  depth: "deep",
  runtime: "auto",
  format: "terminal",
  costCeilingUsd: 10.0,
});

Via CLI

# The CLI commands map to runUnified internally
0 review ./repo --depth deep --runtime claude --cost-ceiling 5
0 scan ./repo --format sarif
0 audit ./repo --ecosystem npm

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment