Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9236a65
feat: add model-free indexing and current source relationships
PatrickSys Oct 11, 2026
129ad6b
Await filesystem casing probe before starting search assertion
PatrickSys Oct 11, 2026
49d9cea
fix: keep local agent context current and verifiable
PatrickSys Oct 15, 2026
a9eff27
test: freeze identifier nomination behavior
PatrickSys Oct 15, 2026
886aeb0
test: freeze grounded rescue nomination controls
PatrickSys Oct 15, 2026
ae3c3c8
test: freeze supplemental public retrieval queries
PatrickSys Oct 15, 2026
f01bb03
test: align supplemental query IDs with eval schema
PatrickSys Oct 15, 2026
5b1b629
test: freeze general rescue density controls
PatrickSys Oct 15, 2026
22f4468
test: freeze structural context regression cases
PatrickSys Oct 15, 2026
2210581
test: freeze analyzer routing source facts
PatrickSys Oct 15, 2026
6672b85
Preserve current source declarations in model-free search
PatrickSys Oct 15, 2026
a9cd0bd
fix: support Node 22 and 24 and explain first-run indexing
PatrickSys Oct 16, 2026
0d733f1
fix: show usage when you run the help command
PatrickSys Oct 16, 2026
5021b4f
docs: make setup instructions clear before and after the release
PatrickSys Oct 16, 2026
cfaa90b
fix: set up Claude Code and Codex from your project folder
PatrickSys Oct 16, 2026
19ddb1c
fix: refuse root dotted Codex init entries
PatrickSys Oct 16, 2026
7d0e65e
docs: keep release instructions accurate and easy to follow
PatrickSys Oct 16, 2026
e148606
Set up detected coding tools together
PatrickSys Oct 16, 2026
c69d326
Clarify search comments
PatrickSys Oct 16, 2026
9885166
Allow time for a cold package install
PatrickSys Oct 16, 2026
073065e
Reuse detected-tool setup and clarify reindexing
PatrickSys Oct 16, 2026
9e88bd4
Keep setup notes focused on changed behavior
PatrickSys Oct 16, 2026
1928b26
docs: make install commands work against published npm versions (#141)
PatrickSys Oct 20, 2026
e702be0
fix: set up detected tools from one command
cursoragent Oct 29, 2026
5db8705
chore(deps): update Hono and bound Windows tests
dependabot[bot] Oct 29, 2026
01a3d03
test: freeze public first-use retrieval checks
PatrickSys Oct 29, 2026
7376c13
Merge PR131 source for private consistency integration
PatrickSys Oct 29, 2026
7c37a59
Merge detected-tool setup ancestry with published-version guidance
PatrickSys Oct 29, 2026
b34ccca
Merge current-package client launches and fresh-map behavior
PatrickSys Oct 29, 2026
837b5b0
Publish immutable index generations and preserve recovery state
PatrickSys Oct 29, 2026
c536317
Reject invalid source chunks and report late recovery truthfully
PatrickSys Oct 30, 2026
9a8cfea
Bind search evidence and refresh checks to current source
PatrickSys Oct 30, 2026
fd8ce3c
Preserve freshness for excluded import targets
PatrickSys Oct 30, 2026
ad70e85
Retry blocked Windows publication ticket replacements
PatrickSys Oct 30, 2026
51305e2
Preserve saved Codex settings during setup
PatrickSys Oct 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish-npm-on-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish (e.g. v2.3.0)'
description: 'Release tag to publish'
required: true
default: 'v2.3.0'
type: string

permissions:
contents: read
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
version: 10
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '24'
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

Expand All @@ -35,14 +35,17 @@ jobs:
test:
name: Functional Tests
runs-on: ubuntu-latest
strategy:
matrix:
node: [22, 24]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: ${{ matrix.node }}
cache: 'pnpm'
- run: pnpm install --frozen-lockfile

Expand Down
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## Product candidate (not published)

- New projects index and search without embedding or reranker models. Existing index modes are preserved; explicit mode switches rebuild fully. Transformers and LanceDB are optional peers with actionable preflight errors.
- Setup detects supported coding tools and configures the selected tools together. It preserves existing settings, saves version-pinned launches for the selected repository, and leaves indexing to the first search.
- Added `get_code_relationships`: directed import/re-export paths up to three hops, current resolution and source checks, confined endpoints, unresolved/stale diagnostics, and a 4,000-byte response cap. Resolution selects the root's `tsconfig.json` or, when absent, `tsconfig.base.json`, without inheriting an unrelated parent configuration.
- AST chunks preserve contiguous source and static property ownership, including concise descriptor methods, callback bodies and same-line siblings. Generated scope labels remain presentation metadata. Index format 4 rebuilds incompatible indexes even when sources are unchanged, preserves the selected embedding mode, and retains previous artifacts if rebuilding fails.
- Angular TypeScript eligibility uses parsed Angular imports; ordinary `resolve` or `validate` methods, comments, strings and imports from other packages no longer select the Angular analyzer. Other eligible analyzers retain the source and declaration context. The registry order and existing template/style routing are unchanged.
- Compact `signaturePreview` uses a contiguous window of up to three lines around the strongest query-term match in the returned snippet, falling back to its opening lines. Default and explicit exploration searches omit edit preflight while retaining search quality and incomplete-source warnings. Explicit `edit`, `refactor`, and `migrate` intents retain mutation guards.
- Search excludes ordinary stale/unavailable nominees without discarding verified current lower results or triggering an automatic full rebuild. Partial coverage, bounded exhaustion and failed semantic replenishment are explicit; corrupt metadata, build identity, paths and source ranges still fail closed.
- Symbol references scan same-build manifest sources in bounded read batches and skip parsing when a simple ASCII symbol occurs only inside longer identifiers. Unicode or arbitrary query spellings retain raw-text nomination. Coverage keeps raw-text absence separate from parser work and uncertain lexical fallback. Keyword artifact identity uses the shared index validator. Graph traversal verifies edges before consuming output caps, with bounded inspection and honest continuation.
- Watcher shutdown awaits handle closure and cancels pending callbacks. Connected stdio sessions have no default inactivity shutdown; explicit positive idle timeouts remain supported alongside handshake, EOF and parent-death guards.
- Chunk paths are persisted relative to the selected project root, including explicit-root indexing from another working directory. Previously incorrect relative paths can require a full reindex.
- Query advice is limited to grounded returned source, and abstained searches omit global pattern advice. Same-named symbols in different files remain eligible after file-level deduplication; TypeScript type arguments alone no longer select the JSX analyzer.
- The candidate requires Node 22+. CLI dispatch compares canonical entrypoint identity, including npm symlink launchers, while preserving the exported server's initialization on imports.
- Updated the runtime parser and watcher to remove the legacy braces dependency chain. Watcher exclusions use exact directory names; quoted import and export names retain their public symbol names.
- Known limits: model-free conceptual relevance is not guaranteed. Short requests can miss implementations when query words differ from source names; syntactic edges are not runtime calls; workspace/language-specific resolution can remain unresolved. Packed/protocol tests and scoped negative cases do not establish general agent-quality improvement or customer adoption. No npm publication is implied by this entry.

## [2.3.0](https://github.com/PatrickSys/codebase-context/compare/v2.2.0...v2.3.0) (2026-04-30)


Expand Down
64 changes: 40 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,51 @@

[![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)](https://github.com/PatrickSys/codebase-context/blob/master/package.json)

## Your coding agent doesn't understand your codebase.

Coding agents can read files, but they still have to discover how your repository is organized, which patterns your team follows, and which examples are worth copying.

Codebase Context gives an agent a local view of that information through code search, team patterns, strong examples, and project memory. It runs as an MCP server - a local tool that your editor or command-line agent can call while it works - and keeps the index on your machine by default.
Codebase Context gives coding agents a map of your repository through MCP, for developers who want their agent to find relevant code and follow the team's patterns. Search, examples and project memory run locally by default.

## Set up your AI client

Choose your coding tool and run its command once. Use Node.js 22 or newer. These commands use published npm `2.2.0` and do not require a project folder in your configuration:
Use Node.js 22 or newer. These commands use the current npm release of Codebase Context:

```bash
# Claude Code
claude mcp add --scope user --transport stdio codebase-context -- npx -y codebase-context@2.2.0
claude mcp add --scope user --transport stdio codebase-context -- npx -y codebase-context

# Codex CLI
codex mcp add codebase-context -- npx -y codebase-context@2.2.0
# Codex CLI (this is the Codex setup line)
codex mcp add codebase-context -- npx -y codebase-context

# OpenCode 1.x (keep the quoted separator on Windows)
opencode mcp add codebase-context '--' npx -y codebase-context@2.2.0
opencode mcp add codebase-context '--' npx -y codebase-context
```

In the unreleased candidate, `--version` prints the installed package version and `map` builds a missing index before printing the map. A low-confidence search includes a hint that weak matches do not establish that code is absent. These additions require the built candidate; the unpinned commands above install published 2.2.0.

This repository's `init` command detects Claude Code, Codex, Cursor, and OpenCode and writes a project config for each selected tool. The saved launch is the Node binary and the package file from the npx cache. That command is in this source and is not part of published 2.2.0. Until it is published, use the copy-paste lines above. The [client setup guide](./docs/client-setup.md) marks the unpublished command.

Start a new agent session in your project, then ask:

> Use Codebase Context to find [feature] in this repository. Pass this repository's absolute path as project when checking get_indexing_status and searching. Wait for indexing if needed, read codebase://context, then search_codebase and open a returned source file. Show me the relevant files.
> Use Codebase Context to find [feature] in this repository. Pass this repository's absolute path as project, wait for indexing if needed, and open the relevant source files.

Replace `[feature]` with something you want to find. The first run downloads a local model and indexes the repository; time depends on repository size, CPU and model.

### Planned for 2.4.0 (not yet published)

Replace `[feature]` with something you want to find. The agent supplies the repository path in its tool calls, so the registration can serve different projects. Initial indexing may need a local model download. The October 6 isolated checks proved these client registrations and published-package project selection/search; they did not establish a full native agent investigation.
The unreleased source candidate starts new indexes without a model download. Semantic embeddings are optional; existing indexes keep their recorded mode. Its setup wizard can configure Claude Code, Codex, Cursor and OpenCode using the Node binary and package file that ran setup. These changes are not in the current npm release.

- NestJS support from community contributor Aaron Olin. See the [analyzer details](./docs/capabilities.md#analyzers).
- Better React/Next.js detection and a fix for reranker passage scoring.
- Transformers.js v4 for local models.

Known limits: [Intel Mac indexing crash (#68)](https://github.com/PatrickSys/codebase-context/issues/68), [custom OpenAI endpoints (#70)](https://github.com/PatrickSys/codebase-context/issues/70) and [Ollama (#71)](https://github.com/PatrickSys/codebase-context/issues/71) remain open.

The existing [benchmark](https://github.com/PatrickSys/codebase-context/blob/master/docs/benchmark.md) reports 25.7% expected-file recovery versus jCodeMunch's 27.1% in a fixed retrieval comparison; it does not establish a winner or coding quality.

For Codex Desktop, create or merge `.codex/config.toml` in the project you want to search:

```toml
[mcp_servers.codebase-context]
command = "npx"
args = ["-y", "codebase-context@2.2.0"]
args = ["-y", "codebase-context"]
startup_timeout_sec = 120
```

Expand All @@ -44,13 +56,13 @@ Other clients use their own setup commands:

| Client | Shortest current setup |
| --------------------------- | ---------------------------------------------------------------------------- |
| Gemini CLI | `gemini mcp add --scope user codebase-context npx -y codebase-context@2.2.0` |
| Gemini CLI | `gemini mcp add --scope user codebase-context npx -y codebase-context` |
| Cursor | Add `.cursor/mcp.json` |
| VS Code with GitHub Copilot | Add `.vscode/mcp.json` |
| GitHub Copilot CLI | `copilot mcp add codebase-context -- npx -y codebase-context@2.2.0` |
| GitHub Copilot CLI | `copilot mcp add codebase-context -- npx -y codebase-context` |
| Windsurf | Add `~/.codeium/windsurf/mcp_config.json` |

Check an existing same-name entry before replacing it. To give the server a default folder, append that folder's absolute path to the `npx` arguments. The [client setup guide](./docs/client-setup.md) covers scopes, optional fixed-folder configuration, verification limits and the unreleased installer. Published `2.2.0`'s interactive `init` has registration bugs; use the commands above.
Check an existing same-name entry before replacing it. To give the server a default folder, append that folder's absolute path to the `npx` arguments. The [client setup guide](./docs/client-setup.md) covers scopes, optional fixed-folder configuration and the interactive setup wizard's limitations.

The [client setup guide](./docs/client-setup.md) has the exact commands and config for every client, plus what was checked locally and what still relies on official instructions.

Expand All @@ -64,32 +76,36 @@ The default connection is `stdio` (standard input/output): your client starts th

### Team patterns and examples

`get_team_patterns` shows the approaches used in the repository and points to representative files. Published `2.2.0` includes dedicated analyzers for Angular, React and Next.js, with a generic analyzer for other stacks. NestJS support belongs to the newer source candidate.
`get_team_patterns` shows the approaches used in the repository and points to representative files. Dedicated analyzers for Angular, React, and Next.js ship in published 2.2.0; NestJS support (along with React and Next.js detection improvements and a reranker fix) is planned for unpublished 2.4.0.

### Project memory

`remember` stores a convention, decision, gotcha, or past failure for the project. `get_memory` retrieves relevant entries in later sessions, including when the agent or editor changes.

### Review context

The `codebase-context-review` CLI creates a bounded context packet from a committed Git diff. It gives a reviewer context; it does not review code or prove review quality. See the [review-context guide](./docs/review-context.md).

## How it works

1. **Index locally.** Codebase Context scans the project, builds a keyword index, and creates local semantic embeddings - numeric representations used to match code by meaning as well as exact words.
2. **Understand the repository.** The agent can request a compact codebase map with structure, patterns, and representative files.
3. **Find the code for the task.** Search returns ranked files and symbols; the agent reads the selected files before editing.

The same information is available from the terminal. Run these commands from your project root. The first index can take a while because it scans the project and creates local embeddings; once it is ready, inspect the map and search for the code you need:
The same information is available from the terminal. Run these commands from your project root. The first run downloads a local model and indexes the repository; time depends on repository size, CPU and model. Once it is ready, inspect the map and search for the code you need:

```bash
# Build or refresh the local index
npx -y codebase-context@2.2.0 reindex
npx -y codebase-context reindex

# Repository structure, patterns, and representative files
npx -y codebase-context@2.2.0 map
npx -y codebase-context map

# Ranked code search
npx -y codebase-context@2.2.0 search --query "auth middleware"
npx -y codebase-context search --query "auth middleware"

# Current team patterns
npx -y codebase-context@2.2.0 patterns
npx -y codebase-context patterns
```

One stdio server can route across several repositories. Supply `project` in tool calls to select the intended repository; a successful selection becomes the default for later calls in that process. Some clients also announce workspace roots: one root can auto-select, while an ambiguous selection asks for a project instead of guessing. MCP deprecated Roots in its July 2026 revision, so explicit project selection is the documented default rather than a dependency on client discovery.
Expand Down Expand Up @@ -145,8 +161,8 @@ The method and failures are documented so the measurements can be inspected with
- Retrieval measurements describe expected-file coverage, file precision, and reported `peakPrivateGb`, not patch correctness or end-to-end coding quality.
- The paired token observation covers two frozen investigation tasks and records observed agent behavior; it is not a universal token or time guarantee.
- Setup checks differ by client. The detailed guide distinguishes a written config, a config recognized by the client, a local connection, and instructions checked only against official docs.
- Published `2.2.0` has dedicated Angular, React and Next.js analyzers; NestJS support is in the newer source candidate. Other projects use the generic analyzer and the language parsers available for that stack.
- The default searchable-chunk limit is 5,000 per project. Larger repositories can raise it in `.codebase-context/config.json`.
- Dedicated Angular, React, and Next.js analyzers ship in published 2.2.0; NestJS support is planned for unpublished 2.4.0. Other projects use the generic analyzer and the language parsers available for that stack.
- The default searchable-chunk limit is 5,000 per project. Customizing this via `projects[].parsing.maxChunks` in `~/.codebase-context/config.json` requires 2.4.0 (not yet published).
- The agent must identify its repository in tool calls when no default or unambiguous client root is available. Concurrent HTTP client isolation is not established by the stdio routing checks.

## Reference
Expand Down
Loading
Loading