Cortex cortex-setup-project
Bootstrap Cortex for a new project or import existing session history. Use when the user says 'set up Cortex', 'seed this project', 'import my history', 'backfill memories', 'bootstrap memory', 'initialize Cortex for this project', or when starting to use Cortex on an existing codebase that already has Claude Code conversation history.
git clone https://github.com/cdeust/Cortex
T=$(mktemp -d) && git clone --depth=1 https://github.com/cdeust/Cortex "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/cortex-setup-project" ~/.claude/skills/cdeust-cortex-cortex-setup-project && rm -rf "$T"
skills/cortex-setup-project/SKILL.mdSetup Project — Fully Autonomous Bootstrap
Execute all four phases sequentially without asking the user any questions. If a phase fails, attempt automatic recovery before reporting the error. Never ask the user to run commands manually or choose between options.
Phase 1: Infrastructure Verification
- Run
via bash to check if PostgreSQL is running.pg_isready - Call
to verify database connectivity.cortex:memory_stats({}) - If either check fails:
- Run
automatically. Do not ask for permission.bash "${CLAUDE_PLUGIN_ROOT}/scripts/setup.sh" - After setup.sh completes, call
again to verify.cortex:memory_stats({}) - If it still fails, report the error output and stop. Do not continue to later phases.
- Run
- If both checks pass, proceed to Phase 2.
Phase 2: Build Methodology Profiles
- Call
to scan all session history and build cognitive profiles per domain.cortex:rebuild_profiles({"force": true}) - This creates the domain hubs that memories, entities, and discussions link to. It must run before seeding.
- Record the domain count for the final summary.
Phase 3: Codebase Seeding
- Call
wherecortex:seed_project({"directory": "<cwd>"})
is the current working directory.<cwd> - Record the count of discoveries for the final summary.
Phase 3b: Pipeline Codebase Analysis (Optional)
The ai-automatised-pipeline MCP server provides structured codebase analysis (symbol graph, processes, communities, cross-file impact). It is optional — Cortex core memory/recall works without it. Enable only if the user asks for "deeper code understanding", "symbol-level memory", or the codebase is large (>5k files) where substring-based hooks underperform.
- Detection: attempt
. If it succeeds, record the counts (wiki pages, memory entities, KG edges) for the summary and skip to Phase 4.cortex:ingest_codebase({"project_path": "<cwd>"}) - If
fails withingest_codebase
(pipeline not installed/configured):McpConnectionError- Check if the sibling checkout exists at
(or equivalent). If so, run../anthropic/ai-automatised-pipeline/Cargo.toml
(accepts ~1-2 min compile) and re-run the ingest.bash -c 'cd ../anthropic/ai-automatised-pipeline && cargo install --path . 2>&1 | tail -20' - If the source checkout is missing or cargo is unavailable, skip Phase 3b silently and proceed to Phase 4. Do NOT block setup on this.
- Check if the sibling checkout exists at
- The pipeline's auto-wire happens on every SessionStart via
, so once the binary exists on PATH (or sibling source is built), future sessions pick it up automatically. No manual mcp-connections.json editing needed.pipeline_discovery
Phase 4: History Import
- Call
to preview available session files.cortex:backfill_memories({"dry_run": true, "max_files": 500}) - If files are available, call
to import.cortex:backfill_memories({"max_files": 500, "min_importance": 0.35}) - Record the count of imported memories for the final summary.
Phase 5: Consolidation and Verification
- Call
to run decay, compression, CLS, and causal discovery on all memories.cortex:consolidate({}) - Call
to get the final system state.cortex:memory_stats({}) - Call
to identify knowledge gaps.cortex:detect_gaps({})
Final Summary
After all phases complete, print a single summary block:
Cortex Setup Complete --------------------- Domains: <count from rebuild_profiles> Memories stored: <total from memory_stats> Entities: <count from memory_stats> Relationships: <count from memory_stats> Pipeline: <"active — N wiki pages, M memories" | "skipped (not installed)"> Gaps found: <count and brief description from detect_gaps>
Do not print intermediate status updates between phases beyond what the tool calls themselves return. One summary at the end.