Skip to content

Commit 4944f4b

Browse files
committed
docs: rewrite README with pain-first positioning
- Lead with concrete pain examples instead of config blocks - Reorder sections: Discovers → Reasons → Remembers → Protects - Collapse editor-specific setup into expandable details - Trim preflight JSON example - Add 30+ language support mention in opening section - Use possessive "your team" framing throughout
1 parent 04a395f commit 4944f4b

1 file changed

Lines changed: 64 additions & 60 deletions

File tree

README.md

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,60 @@
44

55
A second brain for AI coding agents. MCP server that remembers team decisions, tracks pattern evolution, and guides every edit with evidence.
66

7-
## Quick Start
7+
## The Problem
8+
9+
Your AI agent suggests `constructor(private svc: Service)` when 97% of your team
10+
uses `inject()`. It imports `primeng/button` directly when you have a wrapper
11+
with 847 uses. It copies declining patterns during migrations because it can't
12+
tell what's current from what's being phased out.
13+
14+
**codebase-context** fixes this. It's an MCP server that tracks what your team
15+
actually does, remembers why, and warns before mistakes repeat.
16+
17+
Works with 30+ languages. Deep analysis for Angular, generic support for
18+
TypeScript, Python, Go, Rust, Java, and more.
19+
20+
## What It Does
21+
22+
### Discovers
23+
24+
Hybrid search (BM25 keyword + vector embeddings) with structured filters across 30+ languages:
25+
26+
- **Framework**: Angular, React, Vue
27+
- **Language**: TypeScript, JavaScript, Python, Go, Rust, and 25+ more
28+
- **Component type**: component, service, directive, guard, interceptor, pipe
29+
- **Architectural layer**: presentation, business, data, state, core, shared
30+
- Circular dependency detection, style guide auto-detection, architectural layer classification
31+
32+
### Reasons
33+
34+
Quantified pattern analysis with trend direction. Not "use inject()" — "97% of your team uses inject(), and it's rising."
35+
36+
- `inject()`: 97% adoption vs `constructor()`: 3% — with trend direction (rising/declining)
37+
- `Signals`: rising (last used 2 days ago) vs `RxJS BehaviorSubject`: declining (180+ days)
38+
- Golden files: real implementations scoring highest on modern pattern density — canonical examples to follow
39+
- Pattern conflicts detected: when two approaches in the same category both exceed 20% adoption
40+
41+
### Remembers
42+
43+
Decisions, rationale, and past failures persist across sessions. Not just what your team does — why.
44+
45+
- Internal library usage: `@mycompany/ui-toolkit` (847 uses) vs `primeng` (3 uses) — and _why_ the wrapper exists
46+
- "Tried direct PrimeNG toast, broke event system" — recorded as a failure memory, surfaced before the next agent repeats it
47+
- Conventions from git history auto-extracted: `refactor:`, `migrate:`, `fix:`, `revert:` commits become memories with zero manual effort
48+
49+
### Protects
50+
51+
Before an edit happens, your agent gets a preflight briefing: what to use, what to avoid, what broke last time.
52+
53+
- Preflight card on `search_codebase` with `intent: "edit"` — risk level, preferred/avoid patterns, failure warnings, golden files, impact candidates
54+
- Failure memories bump risk level and surface as explicit warnings
55+
- Confidence decay: memories age (90-day or 180-day half-life). Stale guidance gets flagged, not blindly trusted
56+
- Epistemic stress detection: when evidence is contradictory, stale, or too thin, the preflight card says "insufficient evidence" instead of guessing
857

9-
### Claude Desktop
58+
## Quick Start
1059

11-
Add to `claude_desktop_config.json`:
60+
Add to your MCP client config:
1261

1362
```json
1463
{
@@ -21,6 +70,9 @@ Add to `claude_desktop_config.json`:
2170
}
2271
```
2372

73+
<details>
74+
<summary>Setup for VS Code, Cursor, Windsurf, Claude Code</summary>
75+
2476
### VS Code (Copilot)
2577

2678
Add `.vscode/mcp.json` to your project root:
@@ -68,52 +120,13 @@ Open Settings > MCP and add:
68120

69121
### Claude Code
70122

71-
No config file needed. Add to `.claude/settings.json` or run:
123+
No config file needed. Run:
72124

73125
```bash
74126
claude mcp add codebase-context -- npx -y codebase-context /path/to/your/project
75127
```
76128

77-
## What Makes It a Second Brain
78-
79-
Other tools help AI find code. This one helps AI make the right decisions — by remembering what your team does, tracking how patterns evolve, and warning before mistakes repeat.
80-
81-
### Remembers
82-
83-
Decisions, rationale, and past failures persist across sessions. Not just what the team does — why.
84-
85-
- Internal library usage: `@mycompany/ui-toolkit` (847 uses) vs `primeng` (3 uses) — and _why_ the wrapper exists
86-
- "Tried direct PrimeNG toast, broke event system" — recorded as a failure memory, surfaced before the next agent repeats it
87-
- Conventions from git history auto-extracted: `refactor:`, `migrate:`, `fix:`, `revert:` commits become memories with zero manual effort
88-
89-
### Reasons
90-
91-
Quantified pattern analysis with trend direction. Not "use inject()" — "97% of the team uses inject(), and it's rising."
92-
93-
- `inject()`: 97% adoption vs `constructor()`: 3% — with trend direction (rising/declining)
94-
- `Signals`: rising (last used 2 days ago) vs `RxJS BehaviorSubject`: declining (180+ days)
95-
- Golden files: real implementations scoring highest on modern pattern density — canonical examples to follow
96-
- Pattern conflicts detected: when two approaches in the same category both exceed 20% adoption
97-
98-
### Protects
99-
100-
Before an edit happens, the agent gets a preflight briefing: what to use, what to avoid, what broke last time.
101-
102-
- Preflight card on `search_codebase` with `intent: "edit"` — risk level, preferred/avoid patterns, failure warnings, golden files, impact candidates
103-
- Failure memories bump risk level and surface as explicit warnings
104-
- Confidence decay: memories age (90-day or 180-day half-life). Stale guidance gets flagged, not blindly trusted
105-
- Epistemic stress detection: when evidence is contradictory, stale, or too thin, the preflight card says "insufficient evidence" instead of guessing
106-
- Search quality transparency: `search_codebase` includes `searchQuality` (`ok`/`low_confidence`, signals, confidence, next steps) so ambiguous retrieval is explicit instead of hidden
107-
108-
### Discovers
109-
110-
Hybrid search (BM25 keyword 30% + vector embeddings 70%) with structured filters across 30+ languages:
111-
112-
- **Framework**: Angular, React, Vue
113-
- **Language**: TypeScript, JavaScript, Python, Go, Rust, and 25+ more
114-
- **Component type**: component, service, directive, guard, interceptor, pipe
115-
- **Architectural layer**: presentation, business, data, state, core, shared
116-
- Circular dependency detection, style guide auto-detection, architectural layer classification
129+
</details>
117130

118131
## Measured Results
119132

@@ -127,7 +140,7 @@ Tested against a real enterprise Angular codebase (~30k files):
127140
| Wrapper discovery | `ToastEventService`, `DialogComponent` surfaced over raw |
128141
| Golden file identification | Top 5 files scoring 4-6 modern patterns each |
129142

130-
Without this context, AI agents default to generic patterns: raw PrimeNG imports, constructor injection, Jasmine syntax. With the second brain active, generated code matches the existing codebase on first attempt.
143+
Without this context, AI agents default to generic patterns: raw PrimeNG imports, constructor injection, Jasmine syntax. With the second brain active, generated code matches your existing codebase on first attempt.
131144

132145
## How It Works
133146

@@ -153,27 +166,18 @@ When using `search_codebase` with `intent: "edit"`, `"refactor"`, or `"migrate"`
153166
"mode": "triangulated",
154167
"status": "pass",
155168
"readyToEdit": true,
156-
"score": 100,
157-
"sources": [
158-
{ "source": "code", "strength": "strong", "count": 5 },
159-
{ "source": "patterns", "strength": "strong", "count": 3 },
160-
{ "source": "memories", "strength": "strong", "count": 2 }
161-
]
169+
"score": 100
162170
},
163171
"preferredPatterns": [
164-
{ "pattern": "inject() function", "category": "dependencyInjection", "adoption": "98%", "trend": "Rising" }
172+
{ "pattern": "inject() function", "adoption": "98%", "trend": "Rising" }
165173
],
166174
"avoidPatterns": [
167-
{ "pattern": "Constructor injection", "category": "dependencyInjection", "adoption": "2%", "trend": "Declining" }
168-
],
169-
"goldenFiles": [
170-
{ "file": "src/features/auth/auth.service.ts", "score": 6 }
175+
{ "pattern": "Constructor injection", "adoption": "2%", "trend": "Declining" }
171176
],
172177
"failureWarnings": [
173-
{ "memory": "Direct PrimeNG toast broke event system", "reason": "Must use ToastEventService" }
178+
{ "memory": "Direct PrimeNG toast broke event system" }
174179
]
175-
},
176-
"results": [...]
180+
}
177181
}
178182
```
179183

@@ -237,7 +241,7 @@ The MCP creates the following structure in your project:
237241

238242
### Memory System
239243

240-
Patterns tell you _what_ the team does ("97% use inject"), but not _why_ ("standalone compatibility"). Use `remember` to capture rationale that prevents repeated mistakes:
244+
Patterns tell you _what_ your team does ("97% use inject"), but not _why_ ("standalone compatibility"). Use `remember` to capture rationale that prevents repeated mistakes:
241245

242246
```typescript
243247
remember({

0 commit comments

Comments
 (0)