# Indusagi

> A terminal-first AI coding-agent framework — a unified multi-provider LLM gateway, an
> agent runtime with tool-calling, a built-in tool set, an MCP bridge, multi-agent crews, a
> SaaS-connector bridge, an agent-builder, and homegrown tracing. **Clean-room implementation.**

Indusagi is designed and written from scratch — its code reuses no third-party application source.
See [`CREDITS.md`](./CREDITS.md) and [`NOTICE`](./NOTICE).

## Install / build

```bash
npm install
npm run typecheck     # tsc --noEmit  (the type gate)
npm run test          # vitest        (100 tests)
npm run build         # esbuild bundles + tsc declarations -> dist/
npm run lineage-scan  # source-hygiene gate
```

## Use the CLI

```bash
node dist/cli.js --help
node dist/cli.js -m <model> -p "explain this repo"     # one-shot (print) mode
node dist/cli.js -m <model> --json                     # JSON line protocol (wire/RPC) mode
node dist/cli.js -m <model>                             # interactive REPL (minimal text view)
```

Set the provider key for your model (e.g. `ANTHROPIC_API_KEY`, `OPENAI_API_KEY`,
`GEMINI_API_KEY`, …). Attach MCP servers with `--mcp`.

## Architecture (capability layers)

| Layer | Module | Subpath | Responsibility |
|-------|--------|---------|----------------|
| L1 Foundation | `llmgateway` | `indusagi/llmgateway` | Multi-provider LLM gateway (adapters, SSE streaming, model catalog, credentials/PKCE) |
| L2 Agent | `runtime` | `indusagi/runtime` | FSM agent loop, session DAG, compaction, event ledger |
| L3 Tools | `capabilities` | `indusagi/capabilities` | Built-in tools (bash/files/search/web/todo/process) + registry → `ToolBox` |
| L3 External | `interop` | `indusagi/interop` | MCP client/server bridge (official SDK) |
| L3 External | `connectors-saas` | `indusagi/connectors-saas` | Composio SaaS-connector bridge |
| L3 External | `swarm` | `indusagi/swarm` | Multi-agent crews (worktrees, mailbox, task board) |
| L5 Product | `smithy` | `indusagi/smithy` | IndusForge agent-builder |
| L5 Product | `shell-app` | `indusagi/shell-app` | CLI: boot pipeline, flag parsing, runners (print/wire/repl) |
| Cross-cutting | `tracing` | `indusagi/tracing` | Homegrown span tracer (no OpenTelemetry SDK) |

```ts
import { runtime, capabilities, gateway } from "indusagi";

const agent = runtime.createAgent({
  model: "claude-...",
  tools: capabilities.toolBox("coding"),
});
const result = await agent.submit("list the TODOs in this repo");
```

## Status

v0.12.33 — core complete (gateway · runtime · tools · MCP · shell · Composio · crew · IndusForge ·
tracing), **type-clean and 100 tests green**. The interactive terminal UI is a minimal text view
behind an `InteractiveView` seam; a richer UI plugs in there. See [`reports/`](./reports/) for the
per-phase build reports and [`PROVENANCE.md`](./PROVENANCE.md) for the independent-creation log.

## Changelog

See [`CHANGELOG.md`](./CHANGELOG.md) for the full version history.

## License

MIT — see [`NOTICE`](./NOTICE) and [`CREDITS.md`](./CREDITS.md).

## Credits

Indusagi is an independent implementation, designed and written from scratch. See
[`CREDITS.md`](./CREDITS.md) for the open standards it implements and its dependency acknowledgements.
