cortex-hub
AGENTS.md105 starsChanged 35 days agoMITView on GitHub
Current Phase: 6 (Polish, docs, testing, GA release) Start from what you know, not from a fixed ladder: Search once, read all ten. Measured on cortex-hub's own index (benchmarks/retrieval_bench.ts, n=15): the target file is in the top 10 for 15/15 queries but at rank 1 for only 8/15. So scan the whole result set, and never re-run a reworded version of the same query — recall@10 is already 1.000, so it returns the same set. Ask a different question or…
We split this AGENTS.md into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use cortex tools as your primary workflow — they're faster, more focused, and save tokens compared to grep/find.
- Very specific: line 52
Bug protocol: search knowledge/memory first → fix → store non-obvious fixes via knowledge_store.
≈ “Common” is an estimate: at least 1 in 5 of the 36,368 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cortex Hub — Agent Guidelines
Current Phase: 6 (Polish, docs, testing, GA release)
Session Lifecycle
Start
cortex_session_start({ repo: "<repo URL>", mode: "development", agentId: "<your id>" })— save the returnedsessionIdcortex_knowledge_search+cortex_memory_search— recall what happened last sessioncortex_task_pickup()— check for Conductor tasks assigned to you
During Work
Use cortex tools as your primary workflow — they're faster, more focused, and save tokens compared to grep/find.
| What you need | Tool | Why it's better |
| Find code | cortex_code_search | AST-aware, returns focused results (~90% fewer tokens than grep) |
| Understand a symbol | cortex_code_context | Shows callers, callees, imports, process participation |
| Check blast radius | cortex_code_impact | Know what breaks before you edit |
| Pre-commit risk | cortex_detect_changes | Affected symbols + risk rating |
| Graph queries | cortex_cypher | Direct Cypher on the knowledge graph |
| Known solutions | cortex_knowledge_search | Search before debugging from scratch |
| Past decisions | cortex_memory_search | Recall what you or other agents learned |
| Save a fix | cortex_knowledge_store | Team-wide — so nobody debugs this twice |
| Save context | cortex_memory_store | Personal recall for future sessions |
| Other agents' changes | cortex_changes | Check before editing shared files |
| Tool effectiveness | cortex_tool_stats | Usage analytics and success rates |
Start from what you know, not from a fixed ladder:
| You already know | Start with |
| A symbol name | cortex_code_context(name) — exact graph lookup, plus callers/callees/imports in one call |
| Only the behaviour | cortex_code_search(query, limit: 10) — ranked hybrid search, one call |
| An exact literal (env var, config key, error string) | rg / grep — this is not a ranking problem |
| A relationship across files | cortex_cypher |
Search once, read all ten. Measured on cortex-hub's own index (benchmarks/retrieval_bench.ts,
n=15): the target file is in the top 10 for 15/15 queries but at rank 1 for only 8/15. So scan
the whole result set, and never re-run a reworded version of the same query — recall@10 is
already 1.000, so it returns the same set. Ask a different question or switch tool instead.
Knowledge and memory are for errors and decisions, not for locating code. Recall them once at session start, then when something breaks — not before every lookup.
cortex_code_impact before editing something exported or shared; cortex_changes before
touching a file another agent may hold.
Bug protocol: search knowledge/memory first → fix → store non-obvious fixes via knowledge_store.
End
- Verify:
pnpm build && pnpm typecheck && pnpm lint cortex_quality_report— report gate resultscortex_memory_store— persist session context (what was done, decisions, next steps)cortex_session_end(sessionId, summary)— closes session + auto-saves summary as searchable memory
Project Context
Self-hosted MCP platform: code intelligence, persistent memory, shared knowledge, quality enforcement for AI agents.
Tech Stack
- Monorepo: pnpm + Turborepo
- MCP Gateway: Hono (Docker)
- Dashboard: Hono API + Next.js 15
- Backend: Qdrant, mem9, GitNexus (Docker Compose)
- Infra: Cloudflare Tunnel, Watchtower
Code Conventions
camelCasevars/functions,PascalCasetypes/components@cortex/*path aliases — never relative cross-package imports- Strict TypeScript — no
anywithout comment - Conventional commits:
feat:,fix:,docs:,chore:
Quality Gates
| Step | Command |
| Build | pnpm build (full, never --filter) |
| Typecheck | pnpm typecheck |
| Lint | pnpm lint |
| Test (deploy only) | pnpm test |
Endpoints
| Service | URL |
| Dashboard | http://localhost:3000 |
| API | http://localhost:4000 |
| MCP | http://localhost:8318 |
Phase Roadmap
- Phase 1: Server + Cloudflare Tunnel
- Phase 2: Monorepo skeleton + shared packages
- Phase 3: Docker stack (Qdrant, CLIProxy, Watchtower)
- Phase 4: Hub MCP Server —
apps/hub-mcp - Phase 5: Dashboard —
apps/dashboard-web - [/] Phase 6: Polish, docs, testing, GA release
Key Documents
| Document | Path |
| Code Conventions | .cortex/code-conventions.md |
| MCP Tool Reference | docs/api/hub-mcp-reference.md |
| Architecture Overview | docs/architecture/overview.md |
| Docker Stack | infra/docker-compose.yml |
Compliance (Automated)
Tool usage is tracked and scored automatically:
- Session Compliance Score —
cortex_session_endgrades your session (A/B/C/D) across 5 categories: Discovery, Safety, Learning, Contribution, Lifecycle - MCP Response Hints — every tool response includes context-aware hints about what to use next
These work on any MCP client — Claude Code, Antigravity, Cursor, Windsurf, Codex.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 28,693 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- .vscode/copilot-instructions.mdCopilot instructions
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

