Skip to content

Turbocharge Claude Code, Cursor, Codex, Gemini & every coding agent: faster, cheaper, with contextual understanding specific to your codebase.

fix: thread persisted --include-dir into the Tier-2 context pipeline

Alex Matthews707ffe851e76
diff --git a/src/context/build.ts b/src/context/build.ts
index 38db8b2b..537a56d9 100644
--- a/src/context/build.ts
+++ b/src/context/build.ts
@@ -17,6 +17,7 @@ import { walkDir } from "../ingest/fs.js";
import { contentHash } from "../util/id.js";
import { relPosix } from "../util/paths.js";
import { readSourceFile } from "../util/source.js";
+import { readIncludeDirs } from "../util/state.js";
import type { Summarizer } from "../ai/summarize.js";
import type { FileSummary, SynthNode, Synthesizer } from "../ai/synthesize.js";
import {
@@ -102,7 +103,10 @@ export async function buildContext(dir: string, opts: BuildOptions): Promise<Bui
const root = resolve(dir);
const outDir = contextDirFor(root, opts.contextDir);
const exts = opts.extensions ?? CODE_EXTENSIONS;
- const files = walkDir(root)
+ // Read root's persisted `--include-dir` override (same lookup source-files.ts
+ // does for the Tier-1 wiring graph) so an included dir like `build/` isn't
+ // invisible to the Tier-2 concept pipeline while the wiring graph sees it.
+ const files = walkDir(root, readIncludeDirs(root))
.filter((f) => exts.some((e) => f.toLowerCase().endsWith(e)))
.filter((f) => !f.startsWith(outDir));
diff --git a/src/context/check.ts b/src/context/check.ts
index 05d9a041..f95dfcd2 100644
--- a/src/context/check.ts
+++ b/src/context/check.ts
@@ -18,6 +18,7 @@ import { walkDir } from "../ingest/fs.js";
import { contentHash } from "../util/id.js";
import { relPosix } from "../util/paths.js";
import { readSourceFile } from "../util/source.js";
+import { readIncludeDirs } from "../util/state.js";
import { CODE_EXTENSIONS } from "./build.js";
import { contextDirFor, readManifest, readNodes } from "./node-file.js";
@@ -56,9 +57,12 @@ export function checkContext(dir: string, opts: CheckOptions = {}): CheckResult
return result;
}
- // Current code files on disk (same rules `init` used).
+ // Current code files on disk (same rules `init` used) — including root's
+ // persisted `--include-dir` override, so this freshness check never
+ // disagrees with buildContext about what "current" means (an included
+ // build/ must not silently vanish from one side and not the other).
const current = new Map<string, string>(); // rel → hash
- for (const file of walkDir(root)) {
+ for (const file of walkDir(root, readIncludeDirs(root))) {
if (file.startsWith(outDir)) continue;
if (!exts.some((e) => file.toLowerCase().endsWith(e))) continue;
try {