
CodeCortex Context Engine
io.github.BehnamJalaliCo由 GitHub 帳號 BehnamJalaliCo 發布v0.1.0a10更新於 Oct 25, 2026
Context intelligence for AI coding agents: navigation, impact, memory, guarded edits.
概覽
一個本機 MCP 伺服器,為編碼代理提供儲存庫地圖、符號與參照查詢、影響分析、混合檢索與受保護的編輯能力。
- 可以做什麼
- 建立儲存庫地圖並檢視結構、圖計數與符合節點,以及儲存庫、圖、Git 與執行階段統計。查詢符號、定義、參照、實作關係,以及本機呼叫與匯入相依性。透過詞彙、語意與結構化檢索取得任務相關證據,並在明確預算內組出精簡脈絡。依反向相依與受影響測試估算影響範圍,並以儲存庫證據驗證擬議變更。檢視 Git 歷史、blame、歸屬、拉取請求變更與風險,以及推斷的架構與架構漂移。存取專案與團隊記憶、跨多儲存庫工作區搜尋,並檢視執行軌跡。
- 適用情境
- 適合編碼代理在大型或陌生的儲存庫中工作時使用,需要的是有界線、附來源標註的證據,而不是反覆開啟大量檔案:缺陷調查、重構、相依性遷移、PR 審查與上手新專案。也適合希望在 Claude Code、Codex、Cursor、Gemini CLI 或 OpenCode 背後使用本機優先脈絡基礎設施的團隊。
- 執行需求
- 以 Python 套件(codecortex-context-engine,Python 3.11 至 3.13,可用 uvx 或 pip 啟動)透過 stdio 在本機執行。需先用 cortex 命令列初始化並索引儲存庫,再針對儲存庫路徑啟動伺服器。解析器與語意嵌入為選用額外安裝。未宣告驗證、環境變數或請求標頭。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 CodeCortex Context Engine,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
🧠 CodeCortex Context Engine
Open-source context intelligence infrastructure for AI coding agents
Map the repository · resolve symbols · retrieve task-specific evidence · estimate impact · edit with guardrails
[PyPI] [Python] [CI] [CodeQL] [Coverage] [OpenSSF Best Practices] [OpenSSF Scorecard] [License]
⭐ Star CodeCortex · ❤️ Support Project · Documentation · Latest Release · Contribute
Why CodeCortex?
A coding agent can read code. The harder problem is deciding what matters, what is connected, what can break, and how much context is actually worth sending to the model.
CodeCortex turns a repository into a query-specific evidence system for coding agents:
- Repository + symbol intelligence — structure, definitions, references, dependencies, and call relationships.
- Evidence-aware retrieval — lexical, semantic, structural, graph, Git, architecture, and memory signals are ranked together.
- Impact before edits — reverse dependencies, affected tests, ownership, and change risk are inspectable before mutation.
- Guarded changes — semantic edits and structural rewrite previews keep source boundaries and review steps explicit.
- Persistent project context — architecture, history, project/team memory, traces, and multi-repo workspaces survive beyond one chat.
Core rule: retrieve evidence before generating confidence.
60-second start
Requires Python 3.11–3.13.
Then ask the repository useful questions:
Or expose the repository to an MCP-capable coding agent:
Works with coding agents
CodeCortex includes merge-safe project configuration for Claude Code, Codex, Cursor, Gemini CLI, and OpenCode.
The configurator only manages CodeCortex-owned MCP entries and keeps user-owned configuration intact.
See it work locally
The repository ships a deterministic demo project and demo runner:
The demo indexes the fixture repository, analyzes the blast radius of AuthService, routes an evidence request, and reports measured context/trace data. It does not fabricate benchmark values.
Reproducible evidence snapshot
These are committed hardening measurements, not generalized performance promises:
See HARDENING_REPORT.md and benchmarks/ for scope, methodology, limitations, and reproducibility notes.
❤️ Support CodeCortex — If CodeCortex saves you time, consider supporting its continued open-source development. Crypto support →
🇬🇧 English
Give the coding agent a map before asking it to navigate the codebase.
CodeCortex in one sentence
CodeCortex turns a software repository into a query-specific evidence system for AI coding agents.
It sits between an agent and a codebase. It builds durable intelligence about repository structure, symbols, relationships, Git history, ownership, architecture, team decisions, impact, and validation. For each task, it tries to return the smallest useful evidence package instead of forcing the model to reopen broad parts of the repository and reconstruct the same facts again.
CodeCortex is not another general chat UI. It is not a model provider. It does not claim that an agent becomes infallible. It is context infrastructure: a layer that improves what the agent gets to reason with.
Core rule: retrieve evidence before generating confidence.
Why this exists
A strong coding model can read code. The harder engineering problem is deciding what deserves attention, what is connected to it, what changed, what is ambiguous, who owns the area, and what can break after a change.
Without a context engine, the work often looks like this:
search filenames → open broad files → rediscover architecture → guess symbol ownership → infer references → inspect Git manually → guess blast radius → consume a large context window → edit → discover a hidden dependency laterCodeCortex changes the stream:
task → classify intent → gather repository evidence → rank evidence for this task → preserve provenance and uncertainty → fit evidence into a context budget → expose one agent-facing surface → validate the proposed changeThe goal is not more context.
The goal is higher-value evidence per token.
Architecture
Live evidence stream
The repository remains the source of executable truth. Graphs, memory, semantic retrieval, architecture inference, and summaries help interpretation. They do not replace current source, configuration, and tests.
Current capability map
The CodeCortex Doctrine
These are engineering rules, not marketing slogans.
Doctrine 01 — Evidence before confidence
A resolved symbol, a semantic match, an inferred edge, a memory entry, and a Git observation are different evidence classes. CodeCortex should not flatten them into one certainty level.
exact evidence → present as exact strong inference → preserve provenance ambiguous inference → keep alternatives visible missing evidence → report missing stale evidence → report staleDoctrine 02 — Smallest useful context
The best context package is not the largest package that fits. It is the smallest package that contains enough source, relationships, history, and validation evidence to reason about the current task.
Doctrine 03 — Source remains source
Memory can explain intent. Git can explain history. Graphs can explain relationships. Retrieval can suggest relevance. Current source, configuration, tests, and reproducible artifacts remain authoritative for executable behavior.
Doctrine 04 — Uncertainty is information
If two symbols are plausible targets, that ambiguity matters. If architecture is inferred, missing signals matter. If an optional integration cannot run, “unavailable” is more useful than a fabricated success.
Doctrine 05 — Every change has a blast radius
A small diff can be high risk. A large diff can be mechanical. The useful questions are: which symbols changed, who depends on them, which tests exercise them, who owns the area, and what evidence supports the risk.
Doctrine 06 — Local-first is a trust decision
Core repository intelligence works locally. Any network boundary, credential, remote tool, quota, policy, and data transfer must remain explicit.
Doctrine 07 — Reproducibility beats impressive numbers
A benchmark claim without a reproducible specification, pinned revision, environment, measured output, and artifact is not strong evidence.
Doctrine 08 — Scale through explicit coordination
Workers have identity, capability, leases, failure, retry, and state. Shared memory has synchronization and conflict behavior. Remote tools have authentication and policy.
Quick Start
Install
CodeCortex supports Python 3.11, 3.12, and 3.13.
python -m pip install --upgrade codecortex-context-engineOptional parser support:
python -m pip install "codecortex-context-engine[parsers]"Optional local neural semantic embeddings:
python -m pip install "codecortex-context-engine[semantic]"Start inside a repository
cortex init . cortex index cortex doctor cortex architecture cortex semantic "authentication and session lifecycle" cortex impact AuthService cortex symbol-history src/auth.py 10 80 cortex mcp --path .A 30-second mental model
┌────────────────────────────┐ │ Coding Agent │ └─────────────┬──────────────┘ │ task ┌─────────────▼──────────────┐ │ CodeCortex │ │ map · symbols · history │ │ graph · retrieval · memory │ │ impact · architecture │ │ validation · policy │ └─────────────┬──────────────┘ │ bounded evidence ┌─────────────▼──────────────┐ │ Coding Agent │ │ reasons with a better map │ └────────────────────────────┘The agent still reasons. CodeCortex changes what it gets to reason with.
Task streams
Bug investigation
A useful investigation should answer:
- Where is the behavior implemented?
- What callers and references participate?
- What changed recently?
- Which alternate path can invalidate the hypothesis?
- Which test would fail if the explanation is wrong?
- What is the smallest safe change?
Pull-request review
diff → changed files → changed symbols → downstream impact → affected tests → churn / ownership → architecture movement → risk evidence → review contextPR size is only one signal.
Multi-repository work
frontend repo ───────┐ backend repo ────────┼── federated evidence ──→ task context contracts repo ──────┘The repositories keep their identity. CodeCortex federates evidence instead of pretending they are one physical codebase.
Intelligence surfaces
Repository Intelligence — structure before speculation
Incremental indexing turns files and program units into durable repository state. Retrieval, architecture inference, impact analysis, and MCP tools can reuse that state instead of rediscovering the whole repository for every request.
Symbol Intelligence — names, containers, signatures, references
Language-aware parsing extracts program units and keeps container identity where possible. Cross-file resolution intentionally preserves ambiguity and candidate reasons instead of silently choosing a same-name symbol.
Hybrid Retrieval — lexical + semantic + structural
Code is not ordinary prose. CodeCortex combines lexical evidence, semantic similarity, symbol metadata, and structural context. Context slicing favors meaningful structural units and bounded windows instead of uncontrolled file dumps.
Git & PR Intelligence — code has history
Current source answers what the code does now. Git explains how it arrived there. History, blame, ownership, churn, and PR analysis add change evidence to the static code model.
Memory — durable rationale, not a truth replacement
Project memory stores reusable facts and decisions. Team memory adds revisions, actor/source metadata, optimistic concurrency, and conflict behavior. Memory can explain “why,” but current source and tests remain authoritative.
Architecture Intelligence — make structural movement visible
Architecture inference returns evidence and confidence. A saved fingerprint can be compared with the current graph so new dependency directions, coupling growth, and structural drift become inspectable.
Impact & Validation — reason about blast radius
Impact analysis walks reverse relationships and affected tests. Validation challenges a proposed change against repository evidence. A risk score is useful only when the evidence behind it stays visible.
Guarded editing
Current semantic edit operations include:
cortex edit rename src/auth.py AuthService SessionService cortex edit replace src/auth.py AuthService/refresh --body-file ./replacement.txt cortex edit insert-before src/auth.py AuthService --body-file ./imports.txt cortex edit insert-after src/auth.py AuthService --body-file ./helper.txtThe intended change discipline is:
read enough to understand → estimate impact → mutate narrowly → validateNot:
replace text everywhere → hope tests catch itMCP: one agent-facing surface
cortex mcp --path /path/to/repositoryThe MCP surface exposes repository mapping, symbol search, references, dependency graph inspection, impact analysis, hybrid retrieval, compact context, architecture intelligence, Git history, PR intelligence, memory, workspace search, traces, validation, and statistics.
Distributed operation
Workers advertise capabilities. Work is leased. Expired work can be requeued. Remote operation adds authentication, TLS support, quotas, tool policy, organization/workspace policy, and audit evidence.
The dashboard is an observability surface, not an authorization boundary.
Observatory
cortex dashboard -p /path/to/repositoryThe local observatory can surface:
backend health routing distribution context use engine latency graph hotspots task traces architecture drift benchmark history pull-request riskA context engine should be able to explain its own routing, evidence sources, and failure states.
Security model
Security badges are evidence, not a proof that every deployment is secure. A deployment-specific threat model still matters.
Quality, release, and benchmark doctrine
exact commit → quality matrix → security checks → build → smoke test → checksums → SBOM → signing / attestations → releaseA credential-gated integration that cannot run is reported as skipped. It is not counted as success.
Benchmark command:
python scripts/run_production_benchmark.pyA public performance claim should map to a reproducible spec, pinned revision, environment, measured result, and artifact. CodeCortex does not invent token savings, speedups, task-success gains, or accuracy percentages.
Evidence Fusion Layer
Status: shipped. Implementation, tests, benchmarks, documentation, and provenance records are in the repository. All three layers are optional: CodeCortex Core runs with none of them installed and no network access.
CodeCortex fuses several kinds of evidence and tells the agent, for every result, how that result was established. Each record carries a categorical trust tier — exact, near_exact, structural, inferred_high, inferred, weak — plus a provenance label. Two properties are enforced in code, not merely documented: evidence cannot claim the exact tier unless it is fresh, and stale exact evidence never outranks fresh structural evidence.
See docs/EVIDENCE_FUSION.md for the full model, fallback behavior, and security boundaries.
1 — Precision Code Intelligence
The Precision Code Intelligence layer consumes compiler/indexer-grade occurrence evidence when available and distinguishes:
exact definition/reference vs structural relationship vs heuristic candidate vs lexical coincidenceCurrent capabilities:
- precise definition lookup;
- precise references;
- implementation relationships;
- symbol occurrences;
- stale-index detection;
- graph fusion with exact/inferred provenance;
- graceful fallback to current intelligence.
The engine should know not only what it found, but how strongly it knows it.
2 — Version-Aware Dependency Intelligence
The Dependency Intelligence layer joins:
manifest + lockfile + declared version + resolved version + repository usage + version-relevant documentation evidenceQuestions this layer answers:
- Which version is actually resolved?
- Is the requested API valid for that version?
- Is the current pattern outdated?
- Which migration guidance applies?
- Which local files and symbols use the dependency?
External documentation remains optional, minimal-data, credential-aware, cached, and explicit. Core repository intelligence must continue to work offline. Repository source should not leave the system by default just to answer a dependency question.
3 — Structural Search & Guarded Rewrite
The Structural Search & Guarded Rewrite layer handles syntax-aware patterns:
find calls shaped like old_api($X) find constructors using a legacy option shape find handlers that swallow a particular exception form find all structural usages before a framework migrationMutation lifecycle:
A rewrite should be previewed, bounded, content-hash checked, policy-authorized, reindexed, and validated.
Evidence fusion in practice
Example, covered end to end by an acceptance test:
Migrate authentication middleware to the supported API for the version used by this repository.
Stream:
dependency manifest → resolved version → current middleware → precise references → version-relevant documentation → structural occurrences → affected symbols and tests → guarded rewrite preview → mutation policy → validation → post-change impactThe value is not three disconnected tools. The value is one context engine joining local code truth, precise relationships, dependency-version evidence, structural patterns, history, and validation for one task.
Measured on fixture repositories (cortex evidence-benchmark; strategies that cannot be measured are reported as skipped, never estimated):
Shipped capabilities and fallback behavior
Operating profiles
What CodeCortex is not
Design rules
- Typed boundaries.
- Replaceable intelligence.
- Local operation first.
- Explicit context budgets.
- Project-scoped state by default.
- Provenance survives summarization.
- Mutation is a separate privilege.
- Distributed state is explicit.
- Missing evidence stays missing.
- Release claims map to evidence.
Command map
cortex init . cortex index cortex architecture cortex architecture-drift cortex semantic "authentication refresh" cortex impact AuthService cortex symbol-history src/auth.py 10 80 cortex pr main --head HEAD cortex workspace-add backend ../backend cortex workspace-search "payment service" cortex definition src/auth.py 12 7 cortex references src/auth.py 12 7 cortex implementations src/auth.py 12 7 cortex precision-status cortex dependency next cortex dependency-docs next "middleware authentication" cortex structural-search --lang python --pattern 'old_api($X)' cortex rewrite-preview --lang python --pattern 'old_api($X)' --replacement 'new_api($X)' cortex rewrite-apply <preview-id> cortex benchmark cortex evidence-benchmark cortex dashboard cortex doctor cortex mcp --path .Docker
docker build --target core -t codecortex:core . docker build --target full -t codecortex:full . docker compose up dashboardContainerization does not replace authentication, TLS, policy, secret management, or an appropriate deployment threat model.
Project status
CodeCortex is currently alpha.
Public interfaces are still evolving. Breaking changes can occur before 1.0. Evaluate the project by what the current code, tests, CI, documentation, and reproducible artifacts demonstrate.
Engineering use cases
Community
Good First Issues · Report a Bug · Contributing Guide
Documentation
- Architecture
- Distributed operation
- Advanced intelligence
- Evidence fusion
- Integrations
- Quality
- Testing
- Release
- Licensing
- Security
- Contributing
- Governance
- Roadmap
- Cloud & Enterprise Early Access
FAQ
Does CodeCortex replace the coding model?
No. The model still reasons and generates. CodeCortex improves the evidence environment.Does Core require a remote service?
No. Core is local-first. Optional providers can introduce explicit remote boundaries.Does a huge context window make this unnecessary?
No. Window size and evidence quality are different problems.Is every relationship exact?
No. Inferred relationships preserve ambiguity. Precision Code Intelligence adds exact compiler/indexer evidence when available and falls back conservatively when it is not.Can it work across repositories?
Yes. Workspaces federate evidence while preserving repository identity.Can it edit code?
Guarded semantic editing is available through the appropriate backend surface. Read intelligence and mutation remain separate privileges.Maintainer, contribution, and license
CodeCortex is built and maintained by Behnam Jalali.
python -m pip install -e ".[dev]" ruff check . mypy src/codecortex pytestCodeCortex-owned material is licensed under Apache License 2.0. Third-party material remains subject to the license and attribution records kept in the repository.
See LICENSE, NOTICE, SECURITY.md, and CONTRIBUTING.md.
CodeCortex Context Engine
Give the agent a map before asking it to navigate the codebase.
Less noise. More evidence. Inspectable change.
🇮🇷 فارسی
🧠 موتور کانتکست CodeCortex
قبل از اینکه ایجنت حدس بزند، ریپو باید بتواند خودش را توضیح بدهد.
CodeCortex در یک جمله
CodeCortex یک ریپوی نرمافزاری را به یک سیستم شواهدِ مخصوص همان سؤال تبدیل میکند تا ایجنت برنامهنویسی بهجای حدس زدن، با نقشه و مدرک جلو برود.
CodeCortex بین ایجنت و کدبیس میایستد. از ساختار ریپو، سیمبلها، رابطهها، تاریخچه Git، ownership، معماری، تصمیمهای تیم، impact و validation یک لایه هوشمندی ماندگار میسازد. بعد برای هر تسک تلاش میکند کوچکترین بسته evidence مفید را برگرداند، نه اینکه مدل را مجبور کند هر بار نصف ریپو را باز کند و همان واقعیتها را دوباره از صفر بسازد.
این پروژه یک چتبات دیگر نیست. model provider هم نیست. قرار نیست ادعا کند ایجنت را بدون خطا میکند. CodeCortex زیرساخت کانتکست است؛ یعنی چیزی که کیفیت اطلاعات ورودی به reasoning ایجنت را بهتر میکند.
قاعده اصلی: اول evidence را پیدا کن، بعد با confidence حرف بزن.
چرا اصلاً به چنین چیزی نیاز داریم؟
مدل قوی میتواند کد بخواند. مسئله سخت مهندسی این است که بداند کدام کد ارزش توجه دارد، چه چیزی به آن وصل است، چه چیزی عوض شده، کجا ambiguity داریم، مالک آن بخش کیست و اگر تغییر اشتباه باشد چه چیزی میشکند.
بدون موتور کانتکست، جریان معمولاً این شکلی میشود:
جستوجوی اسم فایل → باز کردن فایلهای زیاد → کشف دوباره معماری → حدس زدن مالکیت سیمبل → حدس referenceها → بررسی دستی Git → حدس blast radius → مصرف کانتکست زیاد → ویرایش → کشف یک dependency پنهان در مرحله بعدCodeCortex جریان را عوض میکند:
تسک → تشخیص intent → جمعآوری evidence ریپو → rank کردن برای همین تسک → حفظ provenance و uncertainty → جا دادن evidence داخل context budget → ارائه از یک سطح واحد به ایجنت → validation تغییر پیشنهادیهدف کانتکست بیشتر نیست.
هدف evidence مفیدتر به ازای هر توکن است.
معماری سیستم
استریم زنده Evidence
حقیقت اجرایی همچنان سورس فعلی، کانفیگ و تست است. Graph، memory، semantic retrieval، architecture inference و summary برای فهم بهتر هستند؛ جای source truth را نمیگیرند.
نقشه قابلیتهای فعلی
دکترین CodeCortex
اینها slogan نیستند؛ قانون مهندسیاند.
دکترین ۰۱ — اول evidence، بعد confidence
سیمبل resolveشده، semantic match، edge استنباطی، memory و Git observation کیفیت یکسان ندارند. CodeCortex نباید همه را با یک certainty تحویل دهد.
شاهد دقیق → دقیق نمایش بده استنباط قوی → provenance را نگه دار استنباط مبهم → گزینههای دیگر را نگه دار شاهد وجود ندارد → missing گزارش کن شاهد قدیمی است → stale گزارش کندکترین ۰۲ — کوچکترین کانتکستِ کافی
بهترین context package بزرگترین چیزی نیست که جا شود. بهترین package کمحجمترین چیزی است که برای همان task سورس، رابطه، history و validation کافی داشته باشد.
دکترین ۰۳ — Source همچنان Source است
Memory میتواند دلیل را توضیح دهد. Git تاریخچه را. Graph رابطه را. Retrieval ارتباط احتمالی را. اما رفتار اجرایی را سورس فعلی، کانفیگ، تست و artifact قابل بازتولید مشخص میکند.
دکترین ۰۴ — ابهام خودش اطلاعات است
اگر دو سیمبل target محتملاند، این ambiguity مهم است. اگر معماری inference است، missing signal مهم است. اگر integration اختیاری در دسترس نیست، unavailable بهتر از success ساختگی است.
دکترین ۰۵ — هر تغییر Blast Radius دارد
diff کوچک میتواند پرریسک باشد و diff بزرگ میتواند مکانیکی باشد. سؤال درست این است: چه سیمبلی تغییر کرد، چه کسی به آن وابسته است، چه تستی مسیر را پوشش میدهد، مالک بخش کیست و risk بر چه evidenceای بنا شده.
دکترین ۰۶ — Local-first یک تصمیم اعتماد است
Core intelligence local کار میکند. هر network boundary، credential، remote tool، quota، policy و data transfer باید صریح باشد.
دکترین ۰۷ — Reproducibility از عدد جذاب مهمتر است
Benchmark بدون spec، revision، environment، measured output و artifact evidence قوی نیست.
دکترین ۰۸ — Scale با Coordination صریح ساخته میشود
Worker هویت، capability، lease، failure، retry و state دارد. Shared memory sync و conflict دارد. ابزار remote auth و policy دارد.
شروع سریع
نصب
CodeCortex از Python 3.11، 3.12 و 3.13 پشتیبانی میکند.
python -m pip install --upgrade codecortex-context-engineParser اختیاری:
python -m pip install "codecortex-context-engine[parsers]"Embedding معنایی local اختیاری:
python -m pip install "codecortex-context-engine[semantic]"داخل یک ریپو شروع کن
cortex init . cortex index cortex doctor cortex architecture cortex semantic "authentication and session lifecycle" cortex impact AuthService cortex symbol-history src/auth.py 10 80 cortex mcp --path .مدل ذهنی ۳۰ ثانیهای
┌────────────────────────────┐ │ Coding Agent │ └─────────────┬──────────────┘ │ task ┌─────────────▼──────────────┐ │ CodeCortex │ │ map · symbols · history │ │ graph · retrieval · memory │ │ impact · architecture │ │ validation · policy │ └─────────────┬──────────────┘ │ evidence محدود ┌─────────────▼──────────────┐ │ Coding Agent │ │ با نقشه بهتر reasoning میکند │ └────────────────────────────┘ایجنت هنوز خودش reasoning میکند. CodeCortex چیزی را بهتر میکند که ایجنت با آن reasoning میکند.
استریمهای Task
Bug Investigation
Investigation خوب باید جواب دهد:
- رفتار کجا پیاده شده؟
- چه caller و referenceهایی در مسیرند؟
- اخیراً چه چیزی تغییر کرده؟
- چه مسیر دیگری hypothesis را رد میکند؟
- کدام test باید fail شود اگر توضیح اشتباه است؟
- کوچکترین تغییر امن چیست؟
Pull Request Review
diff → فایل تغییرکرده → سیمبل تغییرکرده → downstream impact → affected tests → churn / ownership → حرکت معماری → risk evidence → review contextاندازه PR فقط یکی از signalهاست.
Multi-Repository
frontend repo ───────┐ backend repo ────────┼── federated evidence ──→ task context contracts repo ──────┘هویت ریپوها حفظ میشود. Evidence federate میشود، نه اینکه وانمود کنیم همه یک codebase فیزیکی هستند.
سطحهای هوشمندی
Repository Intelligence — قبل از حدس ساختار را ببین
Incremental indexing فایلها و program unitها را به state ماندگار تبدیل میکند. Retrieval، معماری، impact و MCP میتوانند همان state را دوباره استفاده کنند.
Symbol Intelligence — اسم، container، signature و reference
Parsing زبانآگاه program unit را استخراج میکند. Cross-file resolution ambiguity و دلیل candidateها را نگه میدارد و same-name symbol را بیصدا یکی فرض نمیکند.
Hybrid Retrieval — lexical + semantic + structural
کد prose معمولی نیست. CodeCortex semantic similarity را با lexical evidence، metadata سیمبل و structural context ترکیب میکند و بهجای file dump، slicing محدود میدهد.
Git & PR Intelligence — کد تاریخ دارد
Source میگوید الان چه اتفاقی میافتد. Git میگوید چطور به اینجا رسیده. History، blame، ownership، churn و PR analysis شواهد تغییر را به مدل static اضافه میکنند.
Memory — rationale ماندگار، نه جایگزین Truth
Project memory fact و decision را نگه میدارد. Team memory revision، actor/source metadata و conflict behavior دارد. Memory «چرا» را نگه میدارد ولی از source و test معتبرتر فرض نمیشود.
Architecture Intelligence — حرکت ساختاری را قابل دیدن کن
Architecture inference evidence و confidence برمیگرداند. Fingerprint ذخیرهشده با graph فعلی مقایسه میشود تا dependency direction و coupling drift دیده شود.
Impact & Validation — Blast Radius را بفهم
Impact relationship معکوس و affected test را دنبال میکند. Validation تغییر پیشنهادی را مقابل evidence ریپو challenge میکند.
ویرایش کنترلشده
عملیات semantic فعلی:
cortex edit rename src/auth.py AuthService SessionService cortex edit replace src/auth.py AuthService/refresh --body-file ./replacement.txt cortex edit insert-before src/auth.py AuthService --body-file ./imports.txt cortex edit insert-after src/auth.py AuthService --body-file ./helper.txtدکترین تغییر:
بهاندازه کافی بخوان → impact را بفهم → محدود mutate کن → validate کننه:
همهجا replace کن → امیدوار باش testها بگیرندMCP: یک سطح واحد برای ایجنت
cortex mcp --path /path/to/repositoryMCP نقشه ریپو، symbol search، reference، dependency graph، impact، hybrid retrieval، compact context، architecture، Git، PR، memory، workspace، trace، validation و stats را ارائه میدهد.
عملیات توزیعشده
Worker capability اعلام میکند، work lease میشود و expired work میتواند requeue شود. Remote operation میتواند auth، TLS، quota، tool policy، organization/workspace policy و audit evidence داشته باشد.
Dashboard سطح observability است، نه authorization.
Observatory
cortex dashboard -p /path/to/repositoryObservatory میتواند اینها را نشان دهد:
backend health routing distribution context use engine latency graph hotspots task traces architecture drift benchmark history pull-request riskموتور کانتکست باید بتواند routing، منبع evidence و failure state خودش را توضیح دهد.
مدل امنیت
Badge امنیتی evidence است، نه تضمین امنیت همه deploymentها. Threat model مخصوص محیط همچنان لازم است.
دکترین Quality، Release و Benchmark
commit دقیق → quality matrix → security checks → build → smoke test → checksum → SBOM → signature / attestation → releaseIntegrationای که credential ندارد باید skipped گزارش شود، نه success.
Benchmark:
python scripts/run_production_benchmark.pyClaim performance باید به spec بازتولیدپذیر، revision پینشده، environment، measured result و artifact وصل باشد. CodeCortex نباید token saving، speedup، task success یا accuracy ساختگی منتشر کند.
لایه Evidence Fusion
وضعیت: منتشر شده. implementation، test، benchmark، documentation و سوابق provenance همگی داخل ریپو هستند. هر سه لایه اختیاریاند: هسته CodeCortex بدون هیچکدام از آنها و بدون دسترسی شبکه کار میکند.
CodeCortex چند نوع evidence را با هم ترکیب میکند و برای هر نتیجه میگوید آن نتیجه چطور اثبات شده است. هر رکورد یک trust tier مشخص دارد — exact، near_exact، structural، inferred_high، inferred، weak — بههمراه برچسب provenance. دو قاعده در خودِ کد اجرا میشوند، نه فقط در مستندات: هیچ evidenceای تا وقتی تازه نباشد نمیتواند ادعای exact کند، و evidence قدیمی هرگز بالاتر از evidence ساختاری تازه رتبه نمیگیرد.
مدل کامل، رفتار fallback و مرزهای امنیتی در docs/EVIDENCE_FUSION.md آمده است.
۱ — Precision Code Intelligence
لایه Precision Code Intelligence در صورت وجود evidence دقیق compiler/indexer-grade تفاوت این سطوح را تشخیص میدهد:
definition/reference دقیق با relationship ساختاری با candidate heuristic با lexical coincidenceقابلیتهای فعلی:
- definition دقیق؛
- reference دقیق؛
- implementation relationship؛
- occurrence سیمبل؛
- stale-index detection؛
- fusion گراف با provenance دقیق/استنباطی؛
- fallback به intelligence فعلی.
سیستم باید فقط نداند چه پیدا کرده؛ باید بداند چقدر دقیق میداند.
۲ — Dependency Intelligence با آگاهی از نسخه
لایه Dependency Intelligence این اطلاعات را کنار هم قرار میدهد:
manifest + lockfile + نسخه declared + نسخه resolved + usage داخل repository + documentation مربوط به همان نسخهسؤالهایی که این لایه پاسخ میدهد:
- نسخه واقعی resolveشده چیست؟
- API پیشنهادی برای همین نسخه معتبر است؟
- pattern فعلی قدیمی است؟
- migration guidance مرتبط چیست؟
- کدام file و symbol از dependency استفاده میکند؟
Documentation بیرونی باید optional، minimal-data، credential-aware، cacheشده و explicit باشد. Core باید offline هم کار کند. سورس ریپو نباید برای جواب dependency question بهصورت پیشفرض از سیستم خارج شود.
۳ — Structural Search و Guarded Rewrite
لایه Structural Search و Guarded Rewrite برای patternهای syntax-aware:
callهایی با شکل old_api($X) constructor با option قدیمی handler با exception pattern خاص همه usageهای ساختاری قبل از migrationجریان mutation:
Rewrite باید preview، bound، content-hash check، policy authorization، reindex و validation داشته باشد.
مقصد واقعی: Evidence Fusion
مثال task آینده:
Middleware احراز هویت را به API درست برای نسخهای که همین پروژه استفاده میکند migrate کن.
استریم مطلوب:
dependency manifest → نسخه resolved → middleware فعلی → reference دقیق → documentation مربوط به نسخه → structural occurrence → symbol و test متاثر → guarded rewrite preview → mutation policy → validation → impact بعد از تغییرارزش اصلی سه ابزار جدا نیست. ارزش اصلی یک context engine است که حقیقت محلی کد، رابطه دقیق، نسخه dependency، pattern ساختاری، history و validation را برای یک task به یک package تبدیل کند.
وضعیت فعلی و رفتار fallback
پروفایلهای استفاده
CodeCortex چه چیزی نیست؟
قوانین طراحی
- Boundary typed.
- Intelligence قابل تعویض.
- Local-first.
- Context budget صریح.
- State پروژهای بهصورت پیشفرض.
- Provenance بعد از summary هم باقی میماند.
- Mutation privilege جداست.
- Distributed state صریح است.
- Evidence گمشده ساخته نمیشود.
- Claim انتشار evidence میخواهد.
نقشه دستورات
cortex init . cortex index cortex architecture cortex architecture-drift cortex semantic "authentication refresh" cortex impact AuthService cortex symbol-history src/auth.py 10 80 cortex pr main --head HEAD cortex workspace-add backend ../backend cortex workspace-search "payment service" cortex definition src/auth.py 12 7 cortex references src/auth.py 12 7 cortex precision-status cortex dependency next cortex dependency-docs next "middleware authentication" cortex structural-search --lang python --pattern 'old_api($X)' cortex rewrite-preview --lang python --pattern 'old_api($X)' --replacement 'new_api($X)' cortex rewrite-apply <preview-id> cortex benchmark cortex evidence-benchmark cortex dashboard cortex doctor cortex mcp --path .Docker
docker build --target core -t codecortex:core . docker build --target full -t codecortex:full . docker compose up dashboardContainerization جای auth، TLS، policy، secret management و threat model مناسب را نمیگیرد.
وضعیت پروژه
CodeCortex فعلاً Alpha است.
interfaceهای عمومی هنوز تکامل پیدا میکنند و قبل از 1.0 breaking change ممکن است. پروژه را باید با چیزی سنجید که code، test، CI، documentation و artifact قابل بازتولید واقعاً نشان میدهند.
سناریوهای مهندسی
مشارکت در پروژه
Good First Issues · گزارش باگ · راهنمای مشارکت
مستندات
- Architecture
- Distributed
- Advanced Intelligence
- Evidence Fusion
- Integrations
- Quality
- Testing
- Release
- Licensing
- Security
- Contributing
- Governance
- Roadmap
- Cloud & Enterprise Early Access
سؤالهای پرتکرار
آیا CodeCortex جای مدل را میگیرد؟
نه. مدل reasoning و generation را انجام میدهد. CodeCortex محیط evidence را بهتر میکند.Core به سرویس remote نیاز دارد؟
نه. Core local-first است. provider اختیاری میتواند boundary ریموت صریح داشته باشد.Context window خیلی بزرگ این پروژه را بینیاز میکند؟
نه. اندازه window و کیفیت evidence دو مسئله متفاوتاند.همه relationshipها دقیقاند؟
نه. رابطههای استنباطی ambiguity را نگه میدارند. Precision Code Intelligence در صورت وجود، evidence دقیق compiler/indexer را اضافه میکند و در نبود آن محافظهکارانه fallback میکند.چند ریپو را پشتیبانی میکند؟
بله. Workspace evidence را federate میکند و هویت repository را نگه میدارد.میتواند کد را edit کند؟
Semantic editing کنترلشده از backend مناسب در دسترس است. Read intelligence و mutation privilege جدا هستند.نگهداری، مشارکت و License
CodeCortex توسط Behnam Jalali ساخته و نگهداری میشود.
python -m pip install -e ".[dev]" ruff check . mypy src/codecortex pytestبخشهای متعلق به CodeCortex تحت Apache License 2.0 منتشر میشوند. اجزای ثالث تابع license و attribution ثبتشده در خود ریپو هستند.
فایلهای LICENSE، NOTICE، SECURITY.md و CONTRIBUTING.md را ببینید.
CodeCortex Context Engine
قبل از اینکه از ایجنت بخواهی داخل کدبیس حرکت کند، به آن نقشه بده.
نویز کمتر. Evidence بیشتر. تغییر قابل بررسی.
來源:README.md,提交 3a59bf9
工具
0版本歷史
2- v0.1.0a10最新Sep 29, 2026
- v0.1.0a9Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分