Cortex

Cortex

Enforces structured, evidence-guided software engineering tasks with cognitive actions (investigate, plan, verify, remember) and persistent state for LLM-based coding agents.

Category
访问服务器

README

Cortex

An evidence-guided agent kernel for software-engineering agents.

Cortex is a small, local-first runtime that sits between an LLM and a set of specialist tools. It does not replace the model's planning or coding ability — it supplies the parts models are consistently bad at preserving across long tool-using tasks:

  • a stable task state,
  • explicit evidence and uncertainty,
  • disciplined tool selection,
  • bounded changes,
  • verification tied to user-visible behavior,
  • durable, structured memory,
  • secret-safe execution.

The result is a model that is forced into a better reasoning loop:

orient → investigate → form hypotheses → declare a boundary → change → verify → preserve evidence

More tools without structure = more ways to get lost. Specialized tools + a kernel = accumulated engineering judgment.


Why

A capable coding model often fails not because it cannot write a function, but because it cannot maintain epistemic discipline through a multi-step task:

user report → broad search → read a few files → infer a likely cause →
edit several files → run one command → interpret partial success as proof →
lose the trail of why each decision was made

Cortex makes tool use stateful, bounded, inspectable, and evidence-driven — without becoming an autonomous black box. The model stays the planner and author; Cortex ensures its claims have an evidence trail and its actions occur inside a declared operating envelope.

What it does

Cortex exposes six cognitive actions instead of dozens of overlapping raw tools:

Action What it enforces
start opens a durable case file; orients on git identity and tool health
investigate routes a question through discovery (vecgrep) then structure (codemap); records evidence with provenance — search output is a candidate, not proof
plan requires a testable hypothesis with a disproof path, a change boundary, and a verification plan — plans without a disproof path are rejected
verify runs the required verifiers (structural review + browser/terminal specs), detects scope drift, and writes a receipt per claim — a claim with no verifier is not_run, never passed
remember persists the outcome and completes the task — completion is impossible without a verification receipt (or an explicit "not possible" acknowledgment)
status phase, unresolved hypotheses, scope drift, missing verification, tool health

These are structural invariants enforced by a phase machine, not by prompting. A model can't skip the disproof path by restating a hypothesis, or call a change "done" without proof.

Install

go install github.com/abdul-hamid-achik/cortex/cmd/cortex@latest
# or, from a clone:
task build   # → ./bin/cortex

Cortex is a single pure-Go binary (CGO_ENABLED=0). The specialist tools it composes (codemap, vecgrep, cairn, glyph, fcheap, vidtrace, tvault) are optional at runtime — every adapter degrades safely when its tool is absent, and Cortex never fabricates a missing tool's output.

Quick start (CLI)

# 1. Open a case and orient
cortex start "Fix post-login checkout redirect" --surface code --surface browser
#   → task_06FK…  [investigating]

# 2. Investigate (routes vecgrep → codemap, records evidence)
cortex investigate task_06FK… "where is the OAuth return URL handled"

# 3. Plan — a hypothesis WITH a disproof path is mandatory
cortex plan task_06FK… \
  --hypothesis "returnTo is dropped before callback :: run login-from-checkout browser flow" \
  --file src/auth/callback.ts --symbol HandleCallback \
  --uncertainty "unsure whether state signing also strips it"

# 4. …make your edits within the boundary, then verify
cortex verify task_06FK… \
  --claim "the OAuth callback preserves the return URL" \
  --browser-spec specs/cairntrace/checkout_return.yml

# 5. Complete — needs a verification receipt to succeed
cortex remember task_06FK… "returnTo was dropped from signed state; fixed and browser-verified" \
  --tag auth --tag oauth

# anytime: inspect the case
cortex status task_06FK… --detail full
cortex list
cortex doctor              # environment + specialist tool health
cortex studio               # interactive read-only case browser (Charm v2 TUI)

Every read command supports --json for machine consumption. Output is styled at a TTY and plain when piped.

MCP server

Cortex speaks the Model Context Protocol over stdio (newline-delimited JSON-RPC):

cortex serve

It exposes ten tools: cortex_start_task, cortex_investigate, cortex_plan, cortex_verify, cortex_remember, cortex_status, cortex_resolve, cortex_abort_task, cortex_read_evidence, cortex_read_artifact.

Register it with mcphub:

mcphub add cortex cortex serve
mcphub sync --write

In gateway mode the agent sees only mcphub, which proxies Cortex's tools as cortex__<tool> and keeps the raw specialist tools available as an expert escape hatch.

The case file

Each non-trivial task gets a durable, human-readable case file under .agent/cases/<taskId>/:

.agent/cases/task_06FK…/
  case.json          # goal, workspace identity, phase, change boundary, required verification
  evidence.jsonl     # append-only ledger of claims with provenance and confidence
  hypotheses.json    # falsifiable explanations + disproof paths
  plan.json          # the planning gate
  verification.json  # receipts: which claim, which verifier, passed/failed/not_run
  commands.jsonl     # non-sensitive audit trail of tool invocations
  summary.md         # the readable outcome

It is the kernel's working memory, not a transcript. Cortex writes .agent/.gitignore so its own state never registers as a workspace change.

The ecosystem it composes

Tool Role in Cortex
codemap structural code graph — impact, callers, diff review
vecgrep semantic/keyword discovery + cross-session memory
cairntrace browser behavior verification
glyphrun terminal/TUI behavior verification
file.cheap (fcheap) durable evidence stash + search
tinyvault (tvault) secret-safe execution boundary (values never enter model context)
mcphub MCP gateway that exposes Cortex as the default agent interface

Documentation

Full docs (built with VitePress) live in docs/. Run locally with task docs. The design specification is in SPEC.md; architecture and contributor guidance in AGENTS.md.

Status

v0.1 (MVP). The kernel, both surfaces (CLI + MCP), all eight adapters, the case-file store, redaction, scope-drift detection, and the verification policy are implemented and tested. See SPEC.md §21 for the milestone roadmap.

License

MIT © 2026 Abdul Hamid Achik

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选