agentleFS
lktieplktiep/cortex-hub/AGENTS.md

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
  1. Distinctive:

    Use cortex tools as your primary workflow — they're faster, more focused, and save tokens compared to grep/find.

    line 16
  2. Very specific:

    Bug protocol: search knowledge/memory first → fix → store non-obvious fixes via knowledge_store.

    line 52

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

Cortex Hub — Agent Guidelines

Current Phase: 6 (Polish, docs, testing, GA release)


Session Lifecycle

Start

  1. cortex_session_start({ repo: "<repo URL>", mode: "development", agentId: "<your id>" }) — save the returned sessionId
  2. cortex_knowledge_search + cortex_memory_search — recall what happened last session
  3. cortex_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 needToolWhy it's better
Find codecortex_code_searchAST-aware, returns focused results (~90% fewer tokens than grep)
Understand a symbolcortex_code_contextShows callers, callees, imports, process participation
Check blast radiuscortex_code_impactKnow what breaks before you edit
Pre-commit riskcortex_detect_changesAffected symbols + risk rating
Graph queriescortex_cypherDirect Cypher on the knowledge graph
Known solutionscortex_knowledge_searchSearch before debugging from scratch
Past decisionscortex_memory_searchRecall what you or other agents learned
Save a fixcortex_knowledge_storeTeam-wide — so nobody debugs this twice
Save contextcortex_memory_storePersonal recall for future sessions
Other agents' changescortex_changesCheck before editing shared files
Tool effectivenesscortex_tool_statsUsage analytics and success rates

Start from what you know, not from a fixed ladder:

You already knowStart with
A symbol namecortex_code_context(name) — exact graph lookup, plus callers/callees/imports in one call
Only the behaviourcortex_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 filescortex_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

  1. Verify: pnpm build && pnpm typecheck && pnpm lint
  2. cortex_quality_report — report gate results
  3. cortex_memory_store — persist session context (what was done, decisions, next steps)
  4. 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

  • camelCase vars/functions, PascalCase types/components
  • @cortex/* path aliases — never relative cross-package imports
  • Strict TypeScript — no any without comment
  • Conventional commits: feat:, fix:, docs:, chore:

Quality Gates

StepCommand
Buildpnpm build (full, never --filter)
Typecheckpnpm typecheck
Lintpnpm lint
Test (deploy only)pnpm test

Endpoints


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

DocumentPath
Code Conventions.cortex/code-conventions.md
MCP Tool Referencedocs/api/hub-mcp-reference.md
Architecture Overviewdocs/architecture/overview.md
Docker Stackinfra/docker-compose.yml

Compliance (Automated)

Tool usage is tracked and scored automatically:

  1. Session Compliance Score — cortex_session_end grades your session (A/B/C/D) across 5 categories: Discovery, Safety, Learning, Contribution, Lifecycle
  2. 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.

Download now (ZIP)

  • 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.

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.