# Turn-1 Cold-Start Codebase Indexing: Seeding Rules & 150+ Symbols With bootstrap_project

Updated: 2026-11-30 · Pillar: MCP Code Graph & Token Savings · Target Query: mcp memory codebase · Canonical: https://memoreal.kolivri.com/articles/turn-1-cold-start-codebase-indexing-mcp

## Direct Answer (TL;DR)

Starting a new AI coding session on an unindexed codebase usually leads to hallucinations and wasted discovery turns. Memoreal's Turn-1 cold-start protocol detects when memories_used === 0, triggers a bootstrap_hint, and executes bootstrap_project to ingest project guidelines (CLAUDE.md, AGENTS.md, .cursorrules) and up to 150 key code symbols in a single deterministic handshake.

## Key Benchmarks & Metrics

- **1 Turn** — Number of agent turns required to fully index rules and symbols (Memoreal Cold-Start Benchmarks)
- **150 Symbols** — Top-level AST functions, classes, and interfaces seeded initially (Memoreal bootstrap_project Specification)
- **<2.5s** — Total onboarding handshake latency on fresh git clone (Claude Code Session Telemetry)

## Cold-Start Onboarding: Ad-Hoc Discovery vs Turn-1 bootstrap_project

| Onboarding Strategy | Initial Turn Count | Token Consumption | Rule Adherence Fidelity | Symbol Discovery |
| --- | --- | --- | --- | --- |
| Ad-Hoc Manual Prompting | 4 to 8 turns of exploratory questions | 40,000+ tokens burned reading files | Low (agent forgets early rules as context grows) | Hit-or-miss keyword searching |
| Static Memory File (MEMORY.md) | 1 turn reading raw markdown file | 5,000 to 15,000 tokens | Medium (static text without AST linking) | Zero (stores raw prose only, no code symbols) |
| Memoreal bootstrap_project Handshake | 1 deterministic turn on session start | <1,500 tokens structured context payload | 100% (rules anchored as high-salience memories) | 150+ core symbols and relationships seeded |

## The Cold-Start Dilemma in Fresh Coding Sessions

Every time a developer opens a new Claude Code, Cursor, or Codex CLI session in a recently cloned repository, the agent starts with complete amnesia. It possesses no awareness of team conventions, architectural boundaries, or core module entrypoints.

To compensate, developers typically spend the first several turns manually explaining the project structure, reminding the model not to use prohibited libraries, and directing it to specific configuration files. If the developer forgets to mention a critical invariant, the agent quickly introduces code that violates team standards.

- Fresh sessions lack context, leading to repetitive manual developer orientation.
- Agents invent patterns that violate unmentioned team engineering standards.
- Manual orientation prompts waste valuable context window space and developer time.

## The Deterministic Turn-1 Handshake Protocol

Memoreal solves the cold-start problem through an automated Turn-1 handshake protocol. At session start, the agent invokes build_context to retrieve established facts and recent context for the workspace namespace. If the response indicates memories_used === 0, the server returns a bootstrap_hint.

Upon receiving the hint, the agent reads the repository's rule files (such as CLAUDE.md, AGENTS.md, or .cursorrules) along with key entrypoint source files, and dispatches them to bootstrap_project in a single MCP tool call.

## Instant Ingestion of Rules and 150+ Core Symbols

Within under 2.5 seconds, bootstrap_project parses the rule headings into durable semantic memories with high salience (0.9), ensuring they remain pinned in subsequent memory retrievals. Concurrently, the engine parses up to 150 top-level functions, classes, and interfaces into the AST graph.

By Turn 2, the agent operates with full institutional memory and architectural grounding. It knows the exact database version, architectural rules, and entrypoint signatures, ready to deliver production-grade code immediately.

## Implementation Example: Bootstrapping a Repository Namespace on Turn 1

```json
{
  "jsonrpc": "2.0",
  "id": 10,
  "method": "tools/call",
  "params": {
    "name": "bootstrap_project",
    "arguments": {
      "namespace": "ecommerce-api",
      "files": [
        {"path": "CLAUDE.md", "content": "# Team Rules\n- Never git rebase\n- PostgreSQL 16 only"},
        {"path": "src/index.ts", "content": "export function startServer() {}"}
      ]
    }
  }
}
```

## Frequently Asked Questions

### When should an agent call bootstrap_project?

An agent should call bootstrap_project on Turn 1 when build_context returns memories_used === 0 or includes a bootstrap_hint.

### What files should be included in the bootstrap payload?

Include project guideline files like CLAUDE.md, AGENTS.md, README.md, and primary entrypoint source files representing core interfaces.

### Does bootstrap_project overwrite existing memories in the namespace?

No. It seeds initial rules and symbols cleanly, merging with existing records and deduplicating identical facts.

## Related Engineering Guides

- [mcp-server-token-usage-cost-reduction](https://memoreal.kolivri.com/articles/mcp-server-token-usage-cost-reduction)
- [mcp-code-graph-vs-raw-grep-file-reads](https://memoreal.kolivri.com/articles/mcp-code-graph-vs-raw-grep-file-reads)
- [ast-mcp-server-polyglot-15-languages](https://memoreal.kolivri.com/articles/ast-mcp-server-polyglot-15-languages)

### 1-Command Setup
Run `npx -y @kolivri/memoreal-mcp setup` to install the persistent memory MCP server.
