Skip to content

Search locally without model downloads and follow imports - #131

Draft
PatrickSys wants to merge 14 commits into
masterfrom
codex/cbc-product-relaunch-20261011
Draft

PatrickSys wants to merge 14 commits into
masterfrom
codex/cbc-product-relaunch-20261011

Conversation

@PatrickSys

@PatrickSys PatrickSys commented Oct 11, 2026 •

Copy link
Copy Markdown
Owner

New repositories search locally without downloading embedding models; existing indexes keep their successful mode.
Search preserves current source context and follows directed imports and re-exports up to three hops.
Setup detects supported coding tools, configures them together, and saves a pinned launch for the selected repository.
The guides explain how to reindex through the CBC installation that owns the optional runtimes.
Tested: 74 focused setup, CLI, entrypoint and release checks pass, along with type checks, build and scoped lint.
Model-free search can miss loosely phrased concepts; import relationships describe source navigation.
Multi-tool setup still needs native Cursor and OpenCode verification and is awaiting publication.
One full-suite test still expects the removed setup preview; this remains a draft.

Fresh projects index without model runtimes; successful existing modes are preserved. Codex setup supports noninteractive project configuration and installed npm launchers. Current source validation, directed import/re-export traversal and root-relative persistence keep source evidence confined and explicit about unresolved paths.

Validation: build/typecheck/format and lint (zero errors); 97 files and 703 tests pass on the local Windows suite. Exact Node 22 Windows and Ubuntu WSL consumers matched all 377 package files and passed first-use source/graph checks. The matching 173-package production audit reported zero current findings. Natural-language retrieval still abstains on the frozen difficult question; native Codex tool use remains approval-denied. This is an unreleased source candidate.

AI-assisted engineering: Codex configured GPT-6.1 Sol High prime and specialists, GPT-6 Luna Medium implementation, GPT-6 Luna High independent review, and one bounded native GPT-6 Astra advisory. Configured routing is observed; backend serving identity is not attested.
Linux Node22 CI passed all703 assertions but correctly failed on an unhandled early rejection: this test started search before awaiting the case-variant filesystem probe. Resolve the probe first so the existing exact corruption rejection is handled immediately. Keep both success and rejection criteria unchanged.

Validation: focused case1/1 and source-validity15/15 pass; Prettier passes. Independent LunaHigh review confirms the sole test ordering change, with no runtime, fixture, assertion, skip or error-suppression change. Linux CI will confirm.

AI contribution: configured GPT-6 Luna Medium implementation, Luna High independent review and GPT-6.1 Sol High integration; backend serving identity is not independently attested.
@PatrickSys

Copy link
Copy Markdown
Owner Author

Every get_symbol_references call now reads and Tree-sitter-parses every indexed file: the chunk prefilter is gone, and findIdentifierOccurrences parses without a cheap text check first. Testing the word on the current file text before parsing would keep current-source truth without the full scan.

  • const candidateFiles = new Map<string, string>();
    for (const chunkRaw of chunks) {
    const chunk = chunkRaw as IndexedChunk;
    const absPath = resolveAbsoluteChunkPath(rootPath, chunk);
    if (!absPath) {
    return {
    status: 'error',
    message:
    'Indexed source location is invalid. Refresh the index before trusting reference results.'
    };
    }
    const relPath = path.relative(rootPath, absPath).replace(/\\/g, '/');
    candidateFiles.set(relPath, absPath);
    }
    let realRootPath: string;
    try {
    realRootPath = await fs.realpath(rootPath);
    } catch {
    return { status: 'error', message: 'Selected project path is missing or unreadable.' };
    }
    for (const [relativePath, absolutePath] of candidateFiles) {
  • const occurrences = await findIdentifierOccurrences(
  • tree = parser.parse(content);

@PatrickSys

Copy link
Copy Markdown
Owner Author

If any of the ~30 search candidates was edited after indexing (before the watcher catches up, or from the CLI), search throws IndexCorruptedError, starts a full re-index and returns status: indexing, while get_code_relationships keeps answering and just marks drifted edges stale. Dropping or flagging the drifted candidate would keep search working.

  • private async validateCandidateSources(
    chunks: Iterable<CodeChunk>,
    checkedSources: Map<string, string>
    ): Promise<void> {
    if (!this.sourceManifest) {
    throw new IndexCorruptedError('Source manifest is unavailable. Full rebuild required.');
    }
    let realRootPath: string | undefined;
    for (const chunk of chunks) {
    const sourcePath = this.getIndexedSourcePath(chunk);
    const sourceKey = path.resolve(this.rootPath, chunk.filePath);
    if (checkedSources.has(sourceKey)) continue;
    const relativePath = path.relative(this.rootPath, sourcePath).replace(/\\/g, '/');
    const expectedHash = this.sourceManifest.files[relativePath];
    if (typeof expectedHash !== 'string') {
    throw new IndexCorruptedError(
    'Indexed source is absent from its manifest. Full rebuild required.'
    );
    }
    try {
    realRootPath ??= await fs.realpath(this.rootPath);
    const realSourcePath = await fs.realpath(sourcePath);
    if (!isPathWithin(realRootPath, realSourcePath)) {
    throw new Error('Source resolves outside the selected project');
    }
    if (!(await fs.stat(realSourcePath)).isFile()) {
    throw new Error('Source is not a regular file');
    }
    const content = await fs.readFile(realSourcePath, 'utf-8');
    if (hashFileContent(content) !== expectedHash) throw new Error('Source content changed');
    checkedSources.set(sourceKey, content);
    } catch {
    throw new IndexCorruptedError(
    `Indexed source is changed or unreadable (${relativePath}). Full rebuild required.`
    );
    }
    }
  • await this.validateCandidateSources(
  • if (error instanceof IndexCorruptedError) {
    console.error('[Auto-Heal] Index corrupted. Triggering background re-index...');
    void ctx.performIndexing();
  • const collectionKeys = ['paths', 'unresolved', 'staleEdges', 'staleUnresolvedEdges'];

@PatrickSys PatrickSys changed the title Make CBC model-free by default with verified source navigation Make CBC model-free by default with current source context Oct 15, 2026
@PatrickSys PatrickSys changed the title Make CBC model-free by default with current source context Search locally without model downloads and follow imports Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant