Skip to content

Milind220/inception

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

inception

Dynamic workflows for any coding agent.

inception is a portable skill + runtime that teaches any coding agent — Codex, OpenCode, Gemini CLI, Claude Code, anything that speaks the Agent Skills standard — to write, run, and observe its own multi-agent orchestration scripts. The agent authors a plain JavaScript workflow; a deterministic runtime executes it in the background, fanning out subagents across any model provider, with budgets, structured output, resumability, and a live TUI.

Think of it as an open-source take on Claude Code's dynamic workflows — except it runs anywhere, routes to any model, and can nest workflows recursively.

Why

Agent-authored orchestration is the most powerful pattern to emerge in coding agents: instead of the model deciding turn-by-turn what to spawn next, it writes a script that holds the loop, the branching, and the intermediate results — so the agent's context holds only the final answer. Today that capability is locked inside one proprietary harness.

The pieces to open it up all exist separately:

  • Code-as-orchestration — Cloudflare Code Mode, smolagents CodeAgent
  • Recursive, context-isolated subagents — Claude Code's nested subagents (depth 5), the Recursive Language Models result
  • Cross-agent skill portability — the SKILL.md standard, adopted by 30+ agents
  • A multi-provider agent harnessFlue: sessions, valibot structured output, per-call cost accounting, sandboxes, an SSE dev server

Nobody has combined them. inception does.

Architecture

┌─────────────────────────────────────────────────────────┐
│  skill/SKILL.md          the portable skill — teaches    │
│                          any agent when and how to       │
│                          write a workflow script         │
├─────────────────────────────────────────────────────────┤
│  packages/runtime        agent() / parallel() /          │
│                          pipeline() / phase() / budget   │
│                          + journal (resume), concurrency │
│                          caps, NDJSON events, recursion  │
├─────────────────────────────────────────────────────────┤
│  @flue/runtime           sessions, model routing,        │
│                          schemas, sandboxes, cost        │
├─────────────────────────────────────────────────────────┤
│  providers               Anthropic · OpenAI · Codex      │
│                          (ChatGPT-plan OAuth) · DeepSeek │
│                          · Fireworks · any OpenAI-compat │
└─────────────────────────────────────────────────────────┘

The skill is a single SKILL.md installed once into ~/.claude/skills, ~/.codex/skills, or .agents/skills. It carries the workflow API reference, quality patterns (adversarial verification, loop-until-dry, judge panels), and complete template workflows the agent adapts rather than writes cold.

The runtime is the part that must never be regenerated by a model: budget stops enforced before every call, agent-count caps, concurrency limits, error isolation (a dead subagent returns null, it doesn't kill the run), a per-run NDJSON journal that makes runs resumable, and a workflow() primitive with a depth counter for recursive nesting.

The TUI (inception watch <runDir>) tails the journal and renders the live agent tree, per-agent cost, and a findings ledger — with replay mode for finished runs.

What a workflow looks like

// src/workflows/bug-hunt.ts
import { createAgent } from '@flue/runtime';
import { local } from '@flue/runtime/node';
import { runWorkflow } from 'inception-workflows';
import * as v from 'valibot';

const Finding = v.object({ title: v.string(), refs: v.array(v.string()) });
const Verdict = v.object({ real: v.boolean(), why: v.string() });
const LANES = ['error handling', 'concurrency', 'input validation'];

export async function run({ init, payload, id }) {
  // local() because subagents read the repo; omit `sandbox` for the in-memory default.
  const hunter = createAgent(() => ({ model: 'anthropic/claude-fable-5', sandbox: local(), cwd: payload.dir }));
  const harness = await init(hunter);

  return runWorkflow(harness, { runId: id, runDir: payload.runDir, budgetUsd: 5 },
    async ({ agent, parallel, phase, budget }) => {
      phase('Find');
      const findings = (await parallel(LANES.map(lane => () =>
        agent(`Hunt for bugs in ${lane}`, {
          schema: v.object({ findings: v.array(Finding) }),
          model: 'openai-codex/gpt-5.3-codex-spark',
        })
      ))).filter(Boolean).flatMap(r => r.findings);

      phase('Verify');
      const confirmed = [];
      for (const f of findings) {
        if (budget.remaining() <= 0) break;
        const votes = await parallel([1, 2, 3].map(() => () =>
          agent(`Try to refute: ${f.title}`, { schema: Verdict, model: 'anthropic/claude-fable-5' })
        ));
        if (votes.filter(Boolean).filter(x => x.real).length >= 2) confirmed.push(f);
      }
      return { confirmed };
    });
}

The orchestrating agent writes this, launches it in a background terminal, and reads back one structured result. Model routing is per-call — finders on a cheap fast model, verifiers on a strong one.

Give it to your agent

Paste this into any coding agent (Claude Code, Codex, OpenCode, Gemini CLI, …) to have it set up and use inception on its own:

Read https://raw.githubusercontent.com/Milind220/inception/main/USE.md and follow
its steps to set up inception, then write and run a dynamic workflow for this task:
<your task here>

USE.md carries the full agent-facing instructions; the skill in skill/SKILL.md is the permanent install for agents you work with regularly.

Provider auth, including your Codex subscription

inception init probes your machine for credentials and generates the Flue provider config (src/app.ts, consumed by flue dev / flue run):

  • ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, DEEPSEEK_API_KEY, …
  • Codex ChatGPT-plan OAuth (~/.codex/auth.json) — route workflow subagents through your existing Codex subscription. This uses an undocumented endpoint that can change without notice; the sanctioned fallback (codex exec --json --output-schema) is built in.

Status

Early but real. The runtime core is implemented and tested (44 passing tests, including adversarial-review regressions); the patterns are distilled from production multi-agent review harnesses. See docs/design.md for the full design and research notes, and examples/bug-hunt.ts for a complete workflow.

Targets Flue >= 0.11 (@flue/runtime). The 0.4-era @flue/sdk API is not supported — @flue/sdk is now Flue's remote client SDK (createFlueClient) for consuming deployed agents/workflows over HTTP, which inception does not use.

  • Runtime: agent()/parallel()/pipeline()/phase()/log()/budget over @flue/runtime (zero runtime deps, structurally typed)
  • Journal + resume (content-hash keyed; edited calls re-run, unchanged calls return cached)
  • Budget stop enforced before every call (provider-reported cost, pricing-table fallback; in-flight overshoot bounded by concurrency × one call), agent cap, concurrency cap
  • Recursive workflow() with depth caps (default 5), shared budget across levels
  • inception-watch CLI: live tail or replay of a run's event stream
  • inception init provider detection / src/ scaffolding (inception init, inception watch)
  • SKILL.md finalized + template workflows
  • Live-verified end to end: real Flue run on openai-codex/gpt-5.3-codex-spark via codex-bridge OAuth, with cross-process resume
  • npm publish
  • Skill exercised by: Claude Code · Codex CLI · OpenCode · Gemini CLI

npm note: the bare inception package name is taken; packages will ship as inception-workflows (or a scope).

License

MIT

About

Dynamic workflows for any coding agent — a portable skill + runtime for agent-authored, recursive multi-agent orchestration on any model provider

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors