Skip to content

Commit c9f56f7

Browse files
committed
Make readme more readable
1 parent a37aaf9 commit c9f56f7

File tree

1 file changed

+53
-46
lines changed

1 file changed

+53
-46
lines changed

README.md

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,30 @@
44

55
[![npm version](https://img.shields.io/npm/v/codebase-context)](https://www.npmjs.com/package/codebase-context) [![license](https://img.shields.io/npm/l/codebase-context)](./LICENSE) [![node](https://img.shields.io/node/v/codebase-context)](./package.json)
66

7-
You're tired of AI agents writing generic code that compiles but completely ignores how your team does things — even with well-curated instructions. You correct the agent, it doesn't remember. Next session, same mistakes.
7+
You're tired of AI agents writing code that 'just works' but fits like a square peg in a round hole - not your conventions, not your architecture, not your repo. Even with well-curated instructions. You correct the agent, it doesn't remember. Next session, same mistakes.
88

9-
This MCP gives agents *just enough* context so they match *how* your team codes, know *why*, and *remember* every correction.
9+
This MCP gives agents _just enough_ context so they match _how_ your team codes, know _why_, and _remember_ every correction.
1010

11-
**Finds the right context** — Search that doesn't just return code. Each result comes back with pattern signals, related team memories, file relationships, and quality indicators. The agent gets curated context, not raw hits.
11+
Here's what codebase-context does:
1212

13-
**Knows your conventions** — Detected from your code, not from rules you wrote. Adoption percentages, trend direction (rising/declining), golden files. What patterns the team is moving toward and what's being left behind.
13+
**Finds the right context** - Search that doesn't just return code. Each result comes back with analyzed -and quantified- coding patterns and conventions, related team memories, file relationships, and quality indicators. The agent gets curated context, not raw hits.
1414

15-
**Remembers across sessions** — Decisions, failures, gotchas — recorded once, surfaced automatically. Conventional git commits (`refactor:`, `migrate:`, `fix:`) auto-extract into memory with zero effort. Stale memories decay and get flagged instead of blindly trusted.
15+
**Knows your conventions** - Detected from your code, not only from rules you wrote. Seeks team consensus and direction by adoption percentages and trends (rising/declining), golden files. What patterns the team is moving toward and what's being left behind.
1616

17-
**Checks before editing** — A preflight card with risk level, patterns to use and avoid, failure warnings, and a `readyToEdit` evidence check. If evidence is thin or contradictory, it says so.
17+
**Remembers across sessions** - Decisions, failures, things that _should_ work but didn't when you tried - recorded once, surfaced automatically. Conventional git commits (`refactor:`, `migrate:`, `fix:`) auto-extract into memory with zero effort. Stale memories decay and get flagged instead of blindly trusted.
1818

19-
One tool call returns all of it. Local-first — your code never leaves your machine.
19+
**Checks before editing** - A preflight card with risk level, patterns to use and avoid, failure warnings, and a `readyToEdit` evidence check. If evidence is thin or contradictory, it says so.
20+
21+
One tool call returns all of it. Local-first - your code never leaves your machine.
2022

2123
<!-- TODO: Add demo GIF here showing search_codebase with preflight card output -->
2224
<!-- ![Demo](./docs/assets/demo.gif) -->
2325

2426
## Quick Start
2527

26-
### Claude Code
28+
Add it to the configuration of your AI Agent of preference:
2729

28-
No config file needed:
30+
### Claude Code
2931

3032
```bash
3133
claude mcp add codebase-context -- npx -y codebase-context /path/to/your/project
@@ -55,7 +57,7 @@ Add `.vscode/mcp.json` to your project root:
5557
"servers": {
5658
"codebase-context": {
5759
"command": "npx",
58-
"args": ["-y", "codebase-context", "${workspaceFolder}"]
60+
"args": ["-y", "codebase-context", "/path/to/your/project"] // Or "${workspaceFolder}"if your workspace is one project only
5961
}
6062
}
6163
}
@@ -91,19 +93,24 @@ Open Settings > MCP and add:
9193
}
9294
```
9395

96+
## Codex
97+
98+
Run codex mcp add codebase-context npx -y codebase-context "/path/to/your/project"
99+
94100
## What It Actually Does
95101

96-
Other tools help AI find code. This one helps AI make the right decisions by knowing what your team does, tracking where patterns are heading, and warning before mistakes happen.
102+
Other tools help AI find code. This one helps AI make the right decisions - by knowing what your team does, tracking where codebases are heading, and warning before mistakes happen.
97103

98104
### The Difference
99105

100-
| Without codebase-context | With codebase-context |
101-
| --- | --- |
102-
| Generates code using whatever matches or "feels" right | Sees what's rising vs declining in your codebase |
103-
| Copies any example that fits | Follows your best implementations (golden files) |
104-
| Repeats mistakes you already corrected | Surfaces failure memories right before trying again |
105-
| You re-explain the same things every session | Remembers conventions and decisions automatically |
106-
| Edits confidently even when context is weak | Gets `readyToEdit: false` - knows to ask first |
106+
| Without codebase-context | With codebase-context |
107+
| ------------------------------------------------------- | --------------------------------------------------- |
108+
| Generates code using whatever matches or "sounds" right | Generates code following your team conventions |
109+
| Copies any example that fits | Follows your best implementations (golden files) |
110+
| Repeats mistakes you already corrected | Surfaces failure memories right before trying again |
111+
| You re-explain the same things every session | Remembers conventions and decisions automatically |
112+
| Edits confidently even when context is weak | Flags high-risk changes when evidence is thin |
113+
| Sees what the current code does and assumes | Sees how your code has evolved and why |
107114

108115
### The Search Tool (`search_codebase`)
109116

@@ -143,39 +150,39 @@ When the intent is `edit`, `refactor`, or `migrate`, the same call also returns
143150
}
144151
```
145152

146-
Risk level, what to use, what to avoid, what broke last time, and whether the evidence is strong enough to proceed all in one response.
153+
Risk level, what to use, what to avoid, what broke last time, and whether the evidence is strong enough to proceed - all in one response.
147154

148155
### Patterns & Conventions (`get_team_patterns`)
149156

150157
Detects what your team actually does by analyzing the codebase:
151158

152159
- Adoption percentages for dependency injection, state management, testing, libraries
153160
- Patterns/conventions trend direction (Rising / Stable / Declining) based on git recency
154-
- Golden files your best implementations ranked by modern pattern density
155-
- Conflicts when the team hasn't converged (both approaches above 20% adoption)
161+
- Golden files - your best implementations ranked by modern pattern density
162+
- Conflicts - when the team hasn't converged (both approaches above 20% adoption)
156163

157164
### Team Memory (`remember` + `get_memory`)
158165

159-
Record a decision once. It surfaces automatically in search results and preflight cards from then on. **Your git commits also become memories** conventional commits like `refactor:`, `migrate:`, `fix:`, `revert:` from the last 90 days are auto-extracted during indexing.
166+
Record a decision once. It surfaces automatically in search results and preflight cards from then on. **Your git commits also become memories** - conventional commits like `refactor:`, `migrate:`, `fix:`, `revert:` from the last 90 days are auto-extracted during indexing.
160167

161168
- **Types**: conventions (style rules), decisions (architecture choices), gotchas (things that break), failures (we tried X, it broke because Y)
162169
- **Confidence decay**: decisions age over 180 days, gotchas and failures over 90 days. Stale memories get flagged instead of blindly trusted.
163170
- **Zero-config git extraction**: runs automatically during `refresh_index`. No setup, no manual work.
164171

165172
### All Tools
166173

167-
| Tool | What it does |
168-
| --- | --- |
169-
| `search_codebase` | Hybrid search with enrichment. Pass `intent: "edit"` for preflight. |
170-
| `get_team_patterns` | Pattern frequencies, golden files, conflict detection |
171-
| `get_component_usage` | "Find Usages" where a library or component is imported |
172-
| `remember` | Record a convention, decision, gotcha, or failure |
173-
| `get_memory` | Query team memory with confidence decay scoring |
174-
| `get_codebase_metadata` | Project structure, frameworks, dependencies |
175-
| `get_style_guide` | Style guide rules for the current project |
176-
| `detect_circular_dependencies` | Import cycles between files |
177-
| `refresh_index` | Re-index (full or incremental) + extract git memories |
178-
| `get_indexing_status` | Progress and stats for the current index |
174+
| Tool | What it does |
175+
| ------------------------------ | ------------------------------------------------------------------- |
176+
| `search_codebase` | Hybrid search with enrichment. Pass `intent: "edit"` for preflight. |
177+
| `get_team_patterns` | Pattern frequencies, golden files, conflict detection |
178+
| `get_component_usage` | "Find Usages" - where a library or component is imported |
179+
| `remember` | Record a convention, decision, gotcha, or failure |
180+
| `get_memory` | Query team memory with confidence decay scoring |
181+
| `get_codebase_metadata` | Project structure, frameworks, dependencies |
182+
| `get_style_guide` | Style guide rules for the current project |
183+
| `detect_circular_dependencies` | Import cycles between files |
184+
| `refresh_index` | Re-index (full or incremental) + extract git memories |
185+
| `get_indexing_status` | Progress and stats for the current index |
179186

180187
## How the Search Works
181188

@@ -193,19 +200,19 @@ The retrieval pipeline is designed around one goal: give the agent the right con
193200
## Language Support
194201

195202
Over **30+ languages** are supported: TypeScript, JavaScript, Python, Java, Kotlin, C/C++, C#, Go, Rust, PHP, Ruby, Swift, Scala, Shell, and common config/markup formats.
196-
However right now only **Angular** has a specific analyzer for enriched context (signals, standalone components, control flow, DI patterns).
203+
However right now only **Angular** has a specific analyzer for enriched context (signals, standalone components, control flow, DI patterns).
197204
If you need enriched context from any language or framework, please file an issue - or even better, contribute with a new analyzer
198205

199206
Structured filters available: `framework`, `language`, `componentType`, `layer` (presentation, business, data, state, core, shared).
200207

201208
## Configuration
202209

203-
| Variable | Default | Description |
204-
| --- | --- | --- |
205-
| `EMBEDDING_PROVIDER` | `transformers` | `openai` (fast, cloud) or `transformers` (local, private) |
206-
| `OPENAI_API_KEY` || Required only if using `openai` provider |
207-
| `CODEBASE_ROOT` || Project root (CLI arg takes precedence) |
208-
| `CODEBASE_CONTEXT_DEBUG` | | Set to `1` for verbose logging |
210+
| Variable | Default | Description |
211+
| ------------------------ | -------------- | --------------------------------------------------------- |
212+
| `EMBEDDING_PROVIDER` | `transformers` | `openai` (fast, cloud) or `transformers` (local, private) |
213+
| `OPENAI_API_KEY` | - | Required only if using `openai` provider |
214+
| `CODEBASE_ROOT` | - | Project root (CLI arg takes precedence) |
215+
| `CODEBASE_CONTEXT_DEBUG` | - | Set to `1` for verbose logging |
209216

210217
## Performance
211218

@@ -217,7 +224,7 @@ Structured filters available: `framework`, `language`, `componentType`, `layer`
217224

218225
```
219226
.codebase-context/
220-
memory.json # Team knowledge (commit this)
227+
memory.json # Team knowledge (should be persisted in git)
221228
intelligence.json # Pattern analysis (generated)
222229
index.json # Keyword index (generated)
223230
index/ # Vector database (generated)
@@ -231,7 +238,7 @@ Structured filters available: `framework`, `language`, `componentType`, `layer`
231238
!.codebase-context/memory.json
232239
```
233240

234-
## Tip: Auto-invoke in Your Rules
241+
## Tip: Ensuring your AI Agent recalls memory:
235242

236243
Add this to `.cursorrules`, `CLAUDE.md`, or `AGENTS.md`:
237244

@@ -246,9 +253,9 @@ Add this to `.cursorrules`, `CLAUDE.md`, or `AGENTS.md`:
246253

247254
## Links
248255

249-
- [Motivation](./MOTIVATION.md) Research and design rationale
250-
- [Changelog](./CHANGELOG.md) Version history
251-
- [Contributing](./CONTRIBUTING.md) How to add analyzers
256+
- [Motivation](./MOTIVATION.md) - Research and design rationale
257+
- [Changelog](./CHANGELOG.md) - Version history
258+
- [Contributing](./CONTRIBUTING.md) - How to add analyzers
252259

253260
## License
254261

0 commit comments

Comments
 (0)