@aakashpawar/repo-memory
v1.0.3
Published
π§ Create a persistent brain for any code repository β instant context for AI agents
Maintainers
Readme
π§ repo-memory
Create a persistent brain for any code repository β instant context for AI agents.
One command. Zero LLM dependency. Works offline.
npx @aakashpawar/repo-memory initrepo-memory scans your codebase, parses every function/class/module, maps dependencies, detects conventions, and generates a structured MEMORY.md that any AI agent can instantly consume β like giving it the institutional knowledge of a super-senior developer.
Why?
Every time an AI agent starts a new session, it:
- π Wastes tokens re-scanning the repo structure
- π Doesn't know where key logic lives (file + line numbers)
- π§© Loses context about patterns, conventions, and relationships
- πΈ Increases overhead by rebuilding context from scratch
repo-memory solves this with a single MEMORY.md file that persists between sessions.
Installation
# Install globally
npm install -g @aakashpawar/repo-memory
# Or run directly with npx (no install needed)
npx @aakashpawar/repo-memory initQuick Start
# Initialize & index your project
cd your-project
repo-memory init
# Update after changes (fast β only re-indexes modified files)
repo-memory update
# Search for symbols
repo-memory query "payment processing"
# Get details about a specific symbol
repo-memory show PaymentService
# Health check
repo-memory doctorWhat It Generates
MEMORY.md β Your Codebase Brain
# π§ Repository Memory
> my-app | 247 files | 1,832 symbols | Primary: TypeScript
## π Project Overview
- Type: Next.js application
- Package Manager: pnpm
- Build: `pnpm build` | Test: `pnpm test`
## ποΈ Architecture Map
src/ (203 files)
βββ app/ (15 files)
βββ components/ (42 files)
β βββ ui/
β βββ features/
βββ lib/ (8 files)
βββ server/ (31 files)
β βββ routes/
β βββ middleware/
β βββ services/
βββ types/ (5 files)
## ποΈ Key Files & Symbols
### `src/server/services/payment.service.ts` (L1-L187) β 12 dependents
- ποΈ **PaymentService** (L12-L187) `exported`
- `class PaymentService`
- π§ **PaymentService.processPayment** (L34-L89)
- `processPayment(order: Order): Promise<PaymentResult>`
- π§ **PaymentService.refund** (L91-L132)
- `refund(paymentId: string, reason: string): Promise<void>`
## π Dependency Graph
| File | Dependents | Impact |
| -------------------- | ---------- | ----------- |
| `src/lib/api.ts` | 28 | π΄ Critical |
| `src/types/index.ts` | 45 | π΄ Critical |
## π Conventions & Patterns
- File Naming: kebab-case
- Function Naming: camelCase
- Testing: Vitest, Colocated (\*.test.ts files)
## π¨ Critical Paths
1. **`src/lib/api.ts`** β 28 dependents (exports: `createApiClient`, `handleApiError`).repo-memory/index.db β Queryable SQLite Index
A fast, local SQLite database with full-text search for programmatic access:
# Search symbols
repo-memory query "authentication" --json
# Get structured results for AI agents
repo-memory query "error handling" --json --limit 10Supported Languages
| Language | Parsing | Imports | Symbols | | --------------------- | -------- | ------- | ------------------------------------------------------------------- | | TypeScript/JavaScript | β Full | β Full | β Functions, classes, methods, interfaces, types, enums, constants | | Python | β Full | β Full | β Functions, classes, methods, decorators, constants | | Go | β Full | β Full | β Functions, methods, structs, interfaces | | Rust | β Full | β Full | β Functions, structs, enums, traits, impls | | Java/Kotlin | β Full | β Full | β Classes, methods, interfaces | | Other | β Basic | β | β Functions, classes (generic regex) |
Configuration
Create .repo-memory.json in your project root:
{
"ignore": ["generated/", "*.auto.ts"],
"maxTokens": 32000,
"includeLineNumbers": true,
"includeSignatures": true,
"includeDependencies": true,
"includeConventions": true,
"maxKeySymbols": 100,
"maxTreeDepth": 4
}How It Works
repo-memory init
β
βΌ
ββ Scan ββββββββββ Walks repo, respects .gitignore,
β fast-glob β computes file hashes, detects languages
ββββββββββ¬βββββββββ
βΌ
ββ Parse ββββββββββ Regex-based AST extraction for
β Multi-language β functions, classes, methods, imports
ββββββββββ¬βββββββββ
βΌ
ββ Resolve ββββββββ Maps imports β files, computes
β Dependencies β fan-in/fan-out, detects cycles
ββββββββββ¬βββββββββ
βΌ
ββ Detect βββββββββ Project type, test framework,
β Conventions β naming patterns, build system
ββββββββββ¬βββββββββ
βΌ
ββ Store ββββββββββ SQLite + FTS5 full-text search
β .repo-memory/ β for fast queries
ββββββββββ¬βββββββββ
βΌ
ββ Generate βββββββ Token-aware MEMORY.md with
β MEMORY.md β ranked symbols, architecture map
βββββββββββββββββββPerformance
| Repo Size | Files | Time | | ------------------- | ----------- | ---- | | Small (repo-memory) | 13 files | 0.1s | | Medium | ~200 files | ~1s | | Large | ~1000 files | ~5s |
Incremental updates (repo-memory update) only re-index changed files, making them near-instant.
Changelog
See CHANGELOG.md for a list of all releases and changes.
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
License
MIT Β© Aakash Pawar
