Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
31831fe
feat: enhance semantic indexing and approval handling across the appl…
codewithshinde Aug 1, 2026
df17a07
feat: update activity limits, enhance message list styling, and impro…
codewithshinde Aug 1, 2026
dec33d3
feat: add diagram rendering support and enhance code block styling
codewithshinde Aug 1, 2026
d9a502c
feat: enhance TokenMeter component with runtime token tracking and im…
codewithshinde Aug 1, 2026
c7dd0fa
Enhance prompt construction and context handling
codewithshinde Aug 2, 2026
6b0eb54
feat: enhance model selection UI and functionality
codewithshinde Aug 2, 2026
bdba189
feat(tests): add unit tests for workspace bug report and enhance plan…
codewithshinde Aug 5, 2026
5f53b56
feat: enhance sidebar and activity panel functionality, improve plan …
codewithshinde Aug 11, 2026
608ac85
feat: P0 add readers for various project manifest formats
codewithshinde Aug 11, 2026
25fe005
feat:P1 integrate TreeSitter runtime support and enhance parsing capa…
codewithshinde Aug 11, 2026
61832cc
feat: P3 enhance workspace indexing with incremental publish and fres…
codewithshinde Aug 11, 2026
25a774d
feat: P3-P4 add tests for RepoGraphBuilder and TextIndexIdentifierFts
codewithshinde Aug 11, 2026
5c0f467
feat: P2 & P6 enhance path validation and identifier handling in rep…
codewithshinde Aug 12, 2026
60a4012
feat(code-navigation): introduce code navigation module with schemas,…
codewithshinde Aug 12, 2026
72d93d0
fixes: P1-8 enhance hybrid retrieval with anchor file paths and impro…
codewithshinde Aug 12, 2026
6b2ee9f
feat(decision-policy): add grant_narrowed reason code and decision tr…
codewithshinde Aug 12, 2026
d205e50
feat: Add support for Anthropic and Gemini LLM ports
codewithshinde Aug 12, 2026
683644b
feat: enhance settings panel with profile management and number input…
codewithshinde Aug 13, 2026
2455344
feat(task-list): implement task list management features
codewithshinde Aug 13, 2026
ba0a6c8
feat(planning): introduce planning process meta step regex for task b…
codewithshinde Aug 14, 2026
49cc42f
feat(v8): enhance skill evidence derivation and shadow authorization
Aug 14, 2026
c71024b
Merge branch 'v3.8.x' of https://github.com/Mitii-dev/Mitii into v3.8.x
Aug 14, 2026
a1eef7d
feat(task-analyzer): enhance README with detailed component functiona…
codewithshinde Aug 14, 2026
acb2a81
feat(task-list): add purpose to task lists and enhance schemas
codewithshinde Aug 15, 2026
abb5349
feat(window-budget): implement window budget management for context w…
codewithshinde Aug 16, 2026
a31dc68
feat(prompt-construction): implement dynamic output token resolution …
codewithshinde Aug 16, 2026
9c01ab0
feat(verification): introduce durable verification records and user s…
codewithshinde Aug 16, 2026
cab7721
feat: enhance agent engine thresholds with exploration reread parameters
codewithshinde Aug 16, 2026
af6fe5f
Refactor Agent Activity Components and Introduce Live Status
codewithshinde Aug 16, 2026
5fe6ae4
feat: Enhance agent engine with exploration stall detection and estab…
codewithshinde Aug 16, 2026
a28893a
fix: update event kind from 'warn' to 'warning' and refactor profile …
codewithshinde Aug 16, 2026
77b5540
feat: enhance settings UI and functionality
Aug 16, 2026
56e02a1
feat: integrate ONNX Runtime support and update semantic index settings
codewithshinde Aug 16, 2026
dff3abe
feat: enhance dynamic output token resolution and adjust related tests
codewithshinde Aug 16, 2026
289f1ac
feat: Implement folder-scoped hybrid retrieval and enhance window bud…
codewithshinde Aug 17, 2026
66577cd
feat: enhance token usage tracking with cache hit/miss metrics
codewithshinde Aug 18, 2026
1b08a36
Refactor error handling and enhance diagnostics across tool runtime a…
codewithshinde Aug 18, 2026
0a3f894
feat(memory): implement stemmer, synonyms, and tokenizer for enhanced…
codewithshinde Aug 18, 2026
52e04e7
feat(source-analysis): integrate Tree-sitter query catalog and parser…
codewithshinde Aug 18, 2026
f303b28
feat: enhance mutation handling and output token management
codewithshinde Aug 18, 2026
e8dec35
feat: implement recovery of leaked tool calls from markup and enhance…
codewithshinde Aug 18, 2026
65aefde
feat: Enhance Workspace Ignore Policy with Security Concerns and Nest…
codewithshinde Aug 19, 2026
a987fa5
feat: add maximum index files setting and enhance indexing logic
codewithshinde Aug 19, 2026
a7f0d8a
feat: enhance handling of mid-work analysis and indexing limits, add …
codewithshinde Aug 19, 2026
5a93b87
feat(task-list): implement refillTaskListFromPlan to manage task list…
Aug 20, 2026
ef1f805
feat: enhance decision policy to handle agent test requests and impro…
Aug 20, 2026
be17ad5
refactor(agent-engine): split the 6k-line pipeline into contract-alig…
Aug 20, 2026
8fda289
feat: Enhance task list functionality with plan step completion tracking
Aug 20, 2026
48ad002
feat(thoroughness): implement clubbed thoroughness settings with dept…
Aug 21, 2026
3456ad8
feat(planning): enhance discovery and planning strategies
Aug 22, 2026
1bac3a3
feat(onnxruntime): stage native binaries and improve package resoluti…
Aug 22, 2026
316a5b6
fix(build): use rmSync for recursive removal of dist directory
Aug 22, 2026
d7075b7
feat(tests): add unit tests for decision policy pipeline and root mar…
Aug 23, 2026
8b6cfc7
feat(benchmark): implement mitii-benchmark-agent for improved CLI int…
Aug 23, 2026
bd9dcd3
feat(cli): enhance setup process and add session banner
Aug 25, 2026
24b91bb
feat(tests): add medium difficulty test cases and suite configuration
Aug 25, 2026
91f8958
feat: add CLI JSON serialization and workspace reset functionality
Aug 25, 2026
dc222cd
feat: add Loop Policy Editor and integrate loop/stall thresholds
Aug 29, 2026
7dba747
feat: introduce loop policy window bands and thresholds
Aug 29, 2026
b89bc4d
feat: add model I/O logging functionality
Aug 29, 2026
e0c2aad
feat: refactor model I/O logging settings and update related document…
Aug 29, 2026
71109c5
feat: implement plan quality floor for discovery in plan mode
Aug 29, 2026
c84a3f6
feat: enhance filesystem mutation tools and decision policy
Aug 29, 2026
97eb55f
feat: implement loop policy configuration and command-line options
Aug 29, 2026
cb18a13
Add retrieval and testing cases for frontend benchmark suite
Aug 29, 2026
6ac3a34
feat: refactor decision-policy module structure and add path scope he…
Aug 29, 2026
53a0b9a
fix: update recovery logic and tests for unfulfilled execute scenarios
Aug 29, 2026
36f1eac
feat: enhance auto-pin management and update styling for improved UI …
Aug 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
20 changes: 18 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,25 @@ legacy/tools-benchmark/tasks/eval/generated/
legacy/tools-benchmark/tasks/eval/generated-smoke/
legacy/tools-benchmark/results/

# Solid benchmark (Phase 14 under tests/)
# Solid benchmark (under tests/benchmark only)
tests/benchmark/results/
tests/benchmark/reports/
tests/benchmark/.workspaces/
tests/benchmark/benchmark.config.json
tests/benchmark/fixtures/**/.mitii/
tests/benchmark/fixtures/**/.next/
tests/benchmark/fixtures/**/dist/
tests/benchmark/fixtures/**/coverage/
tests/benchmark/fixtures/**/.turbo/
tests/benchmark/fixtures/**/.vite/
tests/benchmark/fixtures/**/.cache/
tests/benchmark/fixtures/**/node_modules/
tests/benchmark/fixtures/**/package-lock.json
tests/benchmark/fixtures/**/pnpm-lock.yaml
tests/benchmark/fixtures/**/yarn.lock
tests/benchmark/fixtures/**/bun.lockb
tests/benchmark/fixtures/**/*.tsbuildinfo
tests/reports/

# Fixture sandboxes — deps, builds, Mitii session state
legacy/tools-benchmark/fixtures/**/.mitii/
Expand All @@ -50,4 +60,10 @@ legacy/tools-benchmark/fixtures/**/docs/
legacy/tools-benchmark/fixtures/**/index.html
legacy/tools-benchmark/fixtures/**/src/index.css
legacy/tools-benchmark/fixtures/**/src/main.ts
legacy/tools-benchmark/fixtures/**/src/main.tsx
legacy/tools-benchmark/fixtures/**/src/main.tsx

# Mitii local runtime data
.mitii-session-export.json
.mitii-audit-pack.json

.pnpm-store/
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<a href="LICENSE"><img alt="License: AGPL v3" src="https://img.shields.io/badge/License-AGPL_v3-blue.svg"></a>
<a href="https://code.visualstudio.com/"><img alt="VS Code 1.85+" src="https://img.shields.io/badge/VS%20Code-1.85%2B-007ACC?logo=visualstudiocode"></a>
<a href="https://nodejs.org/"><img alt="Node 20+" src="https://img.shields.io/badge/Node-20%2B-339933?logo=node.js"></a>
<img alt="Version 2.8.5" src="https://img.shields.io/badge/version-2.8.5-111111">
<img alt="Version 2.8.72" src="https://img.shields.io/badge/version-2.8.72-111111">
<a href="https://docs.mitii.dev"><img alt="Documentation" src="https://img.shields.io/badge/docs-docs.mitii.dev-5B5BFF"></a>
</p>

Expand All @@ -30,8 +30,9 @@ Mitii understands a repository before it changes it. It combines local indexing,

- **Repository-aware context** — SQLite FTS5, symbols, vectors, repo maps, diagnostics, Git state, and explicitly attached files.
- **Clear operating modes** — Ask for read-only analysis, Plan complex work, Agent applies changes, and Review inspects results.
- **Evidence-assisted planning** — Plan mode can follow in-scope preflight diagnostics, discover first when evidence is thin, draft from the ask for scoped feature work, or ask clarifying questions when the request is too unclear.
- **Controlled execution** — configurable approvals, dangerous-command blocking, workspace trust checks, and pre-write checkpoints.
- **Model flexibility** — `echo` (local stub) and **OpenAI-compatible** endpoints (Ollama, LM Studio, OpenRouter, OpenAI, Azure OpenAI, DeepSeek, and similar `/v1` APIs). Native Anthropic, Gemini, and Bedrock adapters are not shipped yet.
- **Model flexibility** — `echo` (local stub), native **Anthropic (Claude)** and **Gemini** adapters, plus **OpenAI-compatible** endpoints (Ollama, LM Studio, OpenRouter, OpenAI, Azure OpenAI, DeepSeek, and any `/v1` API).
- **Extensible workflows** — built-in tools, MCP servers (VS Code), project rules, and reusable skills.
- **Local evidence** — session logs and a basic audit-pack export from the VS Code host (settings redacted). Org SSO/RBAC, SIEM webhooks, and managed enterprise policy packs are not implemented yet.

Expand Down Expand Up @@ -111,18 +112,35 @@ Implement the approved plan and run the relevant tests.

Mitii retrieves relevant context, selects the required capabilities, requests approval for protected actions, checkpoints affected files, applies scoped edits, and runs configured or discovered verification commands.

For repair requests with matching preflight diagnostics, Mitii can skip redundant discovery and start from concrete Change steps tied to the failing files. Optional lightweight model enrichment can improve plan wording, but deterministic policy still owns gates, approvals, grants, and verification requirements.

## Evidence-led execution

Agent runs now carry a structured evidence artifact in addition to plan and task state. The goal is to make every major action accountable without making the live task list the source of truth.

- **Discovery report** records the target, files/searches/commands inspected, bounded discovery capacity, and why discovery stopped.
- **Issue inventory** tracks findings from diagnostics/build/verification as issues rather than just counting files.
- **Plan evidence** records how many plan steps are linked to concrete targets, reviewed context, or verification.
- **Execution ledger** records tool actions, edits, verification commands, and stop decisions with safe summaries and paths.
- **Verification delta** records before/after error counts, remaining issues, checks, and the stop reason when verification is available.

The plan remains the execution contract. Task lists are a derived progress view, useful for UI, but subordinate to plan evidence and verification. Once requested verification passes after edits, the agent should stop and summarize instead of continuing because the model produced transitional narration.

## CLI and SDK

### CLI

```bash
pnpm run build:cli
node apps/cli/bin/mitii.js --help
node apps/cli/bin/mitii.js setup --provider ollama --yes
node apps/cli/bin/mitii.js session
node apps/cli/bin/mitii.js ask "Summarize the authentication flow" --echo
node apps/cli/bin/mitii.js index --cwd /path/to/project
node apps/cli/bin/mitii.js status --json
```

See [apps/cli/README.md](apps/cli/README.md) for `ask`, `session`, `index`, `status`, and `export-session`. Daemon / `mitii serve` is deferred.
New users: `mitii setup` writes non-secret provider config, then set an API key in the environment and run `mitii session` (dotted MITII banner + REPL). See [apps/cli/README.md](apps/cli/README.md) for `setup`, `ask`, `session`, `index`, `status`, and `export-session`. Daemon / `mitii serve` is deferred.

### SDK

Expand Down
168 changes: 158 additions & 10 deletions apps/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,28 @@ node apps/cli/bin/mitii.js --help

Legacy npm `@mitii/cli@2.7.x` is a different binary stack — prefer versions published from this tree.

## First run (new users)

```bash
mitii --help # or: mitii -h
mitii setup # pick provider + write .mitii/config.json
export ANTHROPIC_API_KEY=… # or GEMINI_ / OPENAI_ / MITII_API_KEY
mitii session # dotted MITII banner + interactive loop
```

Smoke without a live model:

```bash
mitii ask "What is recursion?" --echo
```

Check what is configured (never prints secrets):

```bash
mitii setup --show
mitii -v # or: mitii --version / mitii version
```

## Quick start

```bash
Expand All @@ -35,39 +57,164 @@ mitii export-session "Summarize this repo" --out session.json --echo

| Command | Behavior |
|---|---|
| `setup` | Interactive (or flag-driven) model/provider setup |
| `ask <prompt>` | SDK ask with streaming, cancel, clarify/approve |
| `session` | Interactive prompt loop |
| `session` | Interactive prompt loop with MITII banner |
| `index` | Full workspace index + publish repository state |
| `status` | Show latest persisted repository state |
| `export-session` | Run ask and write secret-free JSON export |
| `version` / `help` | Version and usage |
| `version` / `help` | Version and usage (`-v` / `--version`, `-h` / `--help`) |

### Modes

| Mode | Behavior |
|---|---|
| `ask` | Q&A / explain (default) |
| `plan` | Read-only plan; no file edits |
| `agent` | Edit + verify with approvals |

Set with `--mode <mode>` or `defaultMode` in config.

### Common options

| Option | Meaning |
|---|---|
| `-h`, `--help` | Show usage |
| `-v`, `--version` | Print package version |
| `--cwd <path>` | Workspace root (default: `process.cwd()`) |
| `--json` | Machine-readable JSON on stdout |
| `--echo` | Force `EchoLlmPort` even when API keys are set |
| `--clarify <text>` | Non-interactive clarification resume |
| `--approve` / `--deny` | Non-interactive approval resume |
| `--out <file>` | Session export path (`export-session`) |
| `--mode <mode>` | `ask` \| `plan` \| `agent` |
| `--loop-policy-json <json>` | Lab: one-off threshold overrides for this run |
| `--no-loop-policy` | Ignore config `loopPolicy` for this run |

Unknown options error out (they are not silently ignored).

`SIGINT` cancels the active run via `run.cancel()`.

## Config
### Loop / stall policy (lab)

By default the CLI uses **window-band standards** from the model context window
(`compact` &lt; 50k, `standard` &lt; 100k, `wide` ≥ 100k). Permanent ship values live in
`@mitii/v8` → `policy/loopPolicyBands.ts`.

Optional lab overrides (same merge as VS Code Developer → Custom loop policy):

```json
{
"provider": "ollama",
"model": "qwen3-coder:30b",
"loopPolicy": {
"enabled": true,
"thresholds": {
"maxReadOnlyToolTurnsBeforeMutationNudge": 14,
"maxRejectedMutationRecoveries": 5
}
}
}
```

```bash
# One-off override (merged on top of config when enabled)
mitii ask "Fix types" --mode agent \
--loop-policy-json '{"maxRejectedMutationRecoveries":5}'

# Force shipped bands only for this run
mitii ask "Fix types" --mode agent --no-loop-policy
```

Leave `loopPolicy` unset (or `"enabled": false`) for deploy / normal use.

### Setup options

| Option | Meaning |
|---|---|
| `--show` | Print current config (no secrets) |
| `--provider <id>` | `ollama`, `anthropic`, `gemini`, `openai`, `deepseek`, … |
| `--model <id>` | Model id |
| `--base-url <url>` | OpenAI-compatible base URL |
| `--global` | Write `~/.mitii/config.json` instead of project `.mitii/` |
| `--test` | Probe the provider after writing |
| `--yes` / `-y` | Non-interactive (requires `--provider`) |

```bash
# Local Ollama
mitii setup --provider ollama --yes

# Claude, then set the key in the shell
mitii setup --provider anthropic --model claude-sonnet-4-5 --yes
export ANTHROPIC_API_KEY=sk-ant-...

# Custom OpenAI-compatible gateway
mitii setup --provider openai-compatible --base-url http://localhost:1234/v1 --model local-model --yes --test
```

## Connect an API

Keys go in the environment. Provider and model go in `.mitii/config.json` or `~/.mitii/config.json` (prefer `mitii setup`).

```bash
# Anthropic (Claude)
export ANTHROPIC_API_KEY=sk-ant-...
mitii ask "What is recursion?"
```

```json
{ "provider": "anthropic", "model": "claude-sonnet-4-5" }
```

No secrets in files:
```bash
# Gemini
export GEMINI_API_KEY=...
# DeepSeek (OpenAI-compatible)
export MITII_API_KEY=...
# OpenAI
export OPENAI_API_KEY=sk-...
```

- `.mitii/config.json` (cwd) or `~/.mitii/config.json`
- Fields: `provider`, `model`, `baseUrl`, `workspaceId`, `defaultMode`
```json
{ "provider": "gemini", "model": "gemini-2.5-flash" }
```

API keys via environment only:
```json
{
"provider": "openai-compatible",
"providerPreset": "deepseek",
"model": "deepseek-chat",
"baseUrl": "https://api.deepseek.com/v1"
}
```

```json
{
"provider": "openai-compatible",
"baseUrl": "http://localhost:11434/v1",
"model": "qwen3-coder:30b"
}
```

- `MITII_API_KEY` / `OPENAI_API_KEY`
- `MITII_BASE_URL`, `MITII_MODEL` (optional overrides)
Overrides: `MITII_PROVIDER`, `MITII_MODEL`, `MITII_BASE_URL`, `MITII_API_KEY`.

Works with local OpenAI-compatible servers (Ollama, LM Studio) without a key when pointed at a local base URL.
Local Ollama / LM Studio do not need a key. Anthropic and Gemini do.

Cursor Cloud Agents are a separate agent API, not an LLM endpoint. Point `openai-compatible` at any `/v1/chat/completions` proxy if you need a custom gateway.

## Session UI

`mitii session` prints a dotted **MITII** banner, then workspace / provider / mode, and the `mitii>` prompt. If you are still on the echo stub, it points you at `mitii setup`.

## Troubleshooting

| Symptom | What to try |
|---|---|
| Echo / stub answers only | `mitii setup`, then export the matching API key |
| `unknown option` | Typos fail loudly — run `mitii --help` |
| Index falls back to snapshot | Optional native deps / embeddings; ask still works with host snapshot |
| No repository state | `mitii index`, or let `ask` auto-index |
| Wrong model | `mitii setup --show`, then `mitii setup` again |

## Out of scope

Expand All @@ -80,6 +227,7 @@ pnpm --filter @mitii/cli typecheck
pnpm --filter @mitii/cli test
pnpm --filter @mitii/cli build
node apps/cli/bin/mitii.js ask "ping" --echo --json
node apps/cli/bin/mitii.js setup --show
```

## Links
Expand Down
6 changes: 4 additions & 2 deletions apps/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mitii/cli",
"version": "2.8.5",
"version": "2.8.72",
"description": "Mitii headless CLI over @mitii/sdk.",
"license": "AGPL-3.0-or-later",
"publishConfig": {
Expand Down Expand Up @@ -40,6 +40,8 @@
"vitest": "^3.2.7"
},
"optionalDependencies": {
"@lancedb/lancedb": "0.33.0"
"@lancedb/lancedb": "0.33.0",
"onnxruntime-node": "1.21.0",
"onnxruntime-web": "1.21.0"
}
}
56 changes: 56 additions & 0 deletions apps/cli/src/banner.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Terminal session chrome for the Mitii CLI.
* Prefer ASCII/Unicode that survives common terminal fonts.
*/

export const MITII_BANNER = `
· · ····· ····· ····· ·····
·· ·· · · · ·
· · · · · · ·
· · · · · ·
· · ····· · ····· ·····
`.replace(/^\n|\n$/g, '');

export interface SessionHeaderOptions {
cwd: string;
providerLabel: string;
mode: string;
version: string;
/** True when running the local echo stub (no live model). */
isEcho?: boolean;
/** Point new users at `mitii setup` when no provider is configured. */
showSetupHint?: boolean;
}

export function formatSessionHeader(options: SessionHeaderOptions): string {
const lines = [
MITII_BANNER,
'',
` Mitii CLI v${options.version} · headless agent`,
` workspace ${options.cwd}`,
` provider ${options.providerLabel}`,
` mode ${options.mode}`,
'',
];

if (options.showSetupHint) {
lines.push(
' No live model yet — answers use the local echo stub.',
' Run mitii setup to choose a provider and write config.',
'',
);
} else if (options.isEcho) {
lines.push(
' Echo mode (--echo or provider=echo) — local stub, no remote API.',
'',
);
}

lines.push(
' Empty line or Ctrl-D to exit · Ctrl-C cancels the active run',
' Modes: ask (Q&A) · plan (read-only plan) · agent (edit + verify)',
'',
);

return `${lines.join('\n')}\n`;
}
Loading
Loading