ichnus2

ichnus2

Enables bug localization by analyzing a repo and bug report with an ant-swarm LLM, returning a HOT/WARM/COLD heatmap and JSON audit trail via MCP.

Category
访问服务器

README

<p align="center"> <img src="assets/readme/01-hero.svg" width="1000" alt="Ichnus" /> </p>

Ichnus is a stigmergic ant-swarm for bug localization. Isolated LLM ants score one file each against a bug report, deposit confidence-weighted heat onto a shared board, and spread it along the import graph with hop decay.

A median-of-3 pass catches random noise. A prosecutor / judge catches confidently wrong answers. You get a HOT / WARM / COLD markdown heatmap plus a full JSON audit trail — callable from Claude Code via MCP.

uv sync
ICHNOS_MOCK=0 uv run python -m ichnos2.demo_runner /path/to/repo \
  "query string drops the first parameter" ""

Why it exists

Grepping a bug description finds similar code. Agents that read the whole repo burn tokens and still guess. Ichnus treats localization as a swarm search with a hard spend ceiling:

  • Ants never talk to each other — they only write the board (O(A) cost, not O(A²))
  • Heat propagates along real import edges, so neighbours of a hot file get scouted next
  • Total ant spend is bounded — wave i uses A0 / 2^i, so spend stays < 2 · A0
  • Two verifiers, two failure modes — median-of-3 for random noise; prosecutor/judge for confidently wrong answers

Architecture

System

<p align="center"> <img src="assets/readme/04-system.svg" width="1000" alt="System architecture" /> </p>

Pipeline

<p align="center"> <img src="assets/readme/05-pipeline.svg" width="1000" alt="Pipeline" /> </p>

Stigmergy

<p align="center"> <img src="assets/readme/06-stigmergy.svg" width="1000" alt="Stigmergy loop" /> </p>

Ant-scored heat is a measurement and never evaporates. Propagated heat is a hypothesis and does. Recruitment makes this a swarm instead of a fixed ranked list: the next wave follows the trail.

Verification

<p align="center"> <img src="assets/readme/07-verify.svg" width="1000" alt="Verification" /> </p>

Stage 7 catches random variance. Stage 8 catches systematic error — a model that is confidently wrong every time. Median-of-3 cannot fix that; changing the question can.

Quick start

Requires Python 3.11+ and uv.

git clone https://github.com/Sharann-del/Ichnus.git
cd Ichnus
uv sync

Offline demo (no API key)

uv run python -m ichnos2.demo_runner /path/to/repo \
  "login fails with empty password" ""

Live run

Put a key in .env (never commit it):

GEMINI_API_KEY=...
# or
OPENROUTER_API_KEY=...

Then set mock mode explicitly whenever a key is present:

ICHNOS_MOCK=0 uv run python -m ichnos2.demo_runner /path/to/repo \
  "bug description" "optional stack trace"
Variable Purpose
ICHNOS_MOCK 1 offline mock · 0 real LLM calls (required when a key is set)
ICHNOS_PROVIDER gemini or openrouter (else inferred from which key exists)
ICHNOS_ANT_MODEL Override the default cheap scout model
ICHNOS_STIGMERGY 1 trail-following (default) · 0 static ranking A/B
ICHNOS_DEBUG_ANTS 1 print client + raw text for the first few ants
ICHNOS_PROSECUTOR_MODEL Optional separate model for Stage 8

Gemini free tier is the practical default for multi-ant waves. OpenRouter’s free quota is easy to exhaust on a mid-size repo; Ichnus fails fast with the reset time rather than spinning on a spent daily limit.

Tests

uv run pytest tests/test_algorithm.py -v

98 tests, no network required.

MCP (Claude Code / any MCP client)

.mcp.json in the project root:

{
  "mcpServers": {
    "ichnus2": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "python3", "-m", "ichnos2.mcp_server"],
      "env": {
        "ICHNOS_MOCK": "0",
        "ICHNOS_PROVIDER": "gemini"
      }
    }
  }
}

Tool: locate_bug_tool(repo_path, bug_description, stack_trace="")
Returns the same markdown heatmap as the CLI. Audit JSON lands at <repo>/.ichnos2/last_audit.json.

uv run python -m ichnos2.mcp_server
# or
uv run ichnos2-mcp

What you get

Markdown heatmap — HOT / WARM / COLD bands with scores, reasons, line ranges, and verification notes.

JSON audit — full board state, ant verdicts, cache provenance, and demotion history under .ichnos2/.

The heatmap is a suggestion for where to read next, not a verdict. Keep using normal file tools after.

How a wave spends budget

Wave i scouts roughly A0 / 2^i files. Across any finite number of waves:

total spend = A0 · (2 − 2^(1−n))  <  2 · A0

This is asserted in the test suite (test_total_budget_bound_proof), not just documented.

Tests and example apps are excluded from scouting by default. A path named in a stack trace is always kept.

Verified results

Measured on this codebase — not invented:

Check Result
Test suite 98 passed
Express real bug (prose symptom, no stack) lib/request.js HOT 10.0, lines 230–241 (defect on 238) in 4/4 cold-cache Gemini runs, ~5–7s
Seeded Python bug via OpenRouter Culprit HOT, defect line pinned; Stage 8 upheld
Mock e2e Stage 8 overturns a planted confident decoy
MCP stdio locate_bug_tool returns the heatmap end-to-end
Stage 1 recall (tiny synthetic sample) 0.8 (4/5)

Design choices that matter

  • Confidence-weighted deposit — ranking uses relevance × confidence
  • Hop decay — γ^hop from the nearest ant-sourced HOT file; cycle-safe BFS
  • Bounded demotion — never below floor × peak
  • Provenance-aware cache — mock and live scores never poison each other
  • Rate-limit aware client — per-minute limits waited out; daily quota stops the run
  • Overlapping file windows — strongest finding wins (averaging dilutes the truth)

Limitations

  • Accuracy is solidly shown on one real bug (Express) plus synthetics — not a broad hit-rate study
  • Ants read one file at a time; they cannot run a repro or reason about whole-repo architecture
  • Non-Python import edges are regex-based; only Python uses AST for authoritative contradictions
  • “Embedding” similarity in Stage 1 is a bag-of-words TF cosine proxy, not a neural embedding
  • Live mode sends file contents to Gemini or OpenRouter — no local-model path yet
  • Free-tier quotas can make “fast” and “works” mutually exclusive

Project layout

ichnos2/
  locate_bug.py
  candidate_filter.py
  budget.py / priority.py
  ants.py
  board.py
  reliability.py
  verify.py
  aggregate.py
  llm_client.py
  mcp_server.py
  demo_runner.py
tests/
  test_algorithm.py

License

MIT © 2026 Sharann Manojkumar

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选