Skip to main content

Overview

RepoMemory is a structured representation of a repository’s architecture, patterns, and conventions. It helps coding agents understand the codebase and make informed changes.

Key Features

  • Evidence-backed claims: All assertions link to specific file locations
  • Branch inheritance: Child experiments inherit parent’s memory
  • Bounded prompts: Summary + TOC keeps context manageable
  • Section-based access: Agents can read specific sections on demand

Schema

Core Sections

Usage

Ensure Memory Exists

Render for Prompts

Output:

Get Specific Section

Bootstrap from Existing Repo

Update After Experiment

max_retries counts repair attempts after the first response. Kapso selects and reads repository files once, then asks the model to repair only malformed JSON or an invalid outer schema. Provider, authentication, transport, and configuration errors are not retried.

Failure Policy

RepoMemory is optional enrichment; experiment code and evaluation results are the primary artifacts. Search strategies therefore default to warning when a baseline or per-experiment memory update fails:
  • warn logs the enrichment error, then still pushes the candidate branch and cleans up the coding agent session.
  • fail still performs branch push and cleanup, then re-raises the original RepoMemory error.
  • Invalid policy values and negative or non-integer retry counts fail during strategy/workspace setup.
Direct calls to RepoMemoryManager.bootstrap_baseline_model() and update_after_experiment() always raise if structured-response repair is exhausted. The warn/fail policy is applied by the search/session lifecycle.

File Location

RepoMemory is stored at .kapso/repo_memory.json in each repository.

Branch Inheritance

When experiments branch from a parent:
  1. Child branch inherits parent’s .kapso/repo_memory.json
  2. After experiment runs, memory is updated with new understanding
  3. Memory is committed to the branch
  4. Future children of this branch inherit the updated memory

Evidence Validation

Claims must have evidence that exists in the repository:

MCP Tools Access

For Claude Code agent, RepoMemory is accessible via MCP tools:
Available sections:
  • core.architecture - System design and module structure
  • core.entrypoints - How to run the application
  • core.where_to_edit - Key files for modifications
  • core.invariants - Contracts, constraints, and assumptions
  • core.testing - How to run tests
  • core.gotchas - Common pitfalls
  • core.dependencies - Key dependencies

Integration with Coding Agents

Prompt Injection

Search strategies inject RepoMemory into prompts:

Section Access Instructions

Agents are told how to access detailed sections via MCP tools:

Quality Metrics