* fix: improve Python impact and surface incompatible keyword calls * fix: resolve Python call imports in the reviewed snapshot (#4012) * fix: verify Python export bindings and incomplete impact walks (#4012) * fix: preserve Python impact and bound signature checks Recover class-specific importers from verified source and surface incomplete walks across MCP and web. Batch Git image reads and bound Python scope extraction so signature checks keep confirmed findings and explain skipped work. Cover the public tool path, mixed Markdown diffs, instruction-file continuation and stale-index hooks. Update the shipped risk guidance and CLI reference. * refactor: delegate query language semantics to providers * refactor: share impact scoring and defer query providers Resolve wildcard caller files once and sort reported paths by code unit. Share instruction-file selection across generation, refresh, and self-commit, and verify worktree selection through the MCP tool. * fix: address provider and language-boundary review feedback (#4012) * fix: report truncated impact walks and honor hook and CLI options (#4012) * fix(web): withhold the completion message after partial enrichment (#4012) * Preserve generated skill rows and distinguish implicit wildcard exports * Clarify partial change results when process lookup fails * Fix incremental caller parity and size writer pools for retained text Refresh globally inferred calls when name uniqueness changes, and exclude name-only guesses from impact traversal. Account for stored source and the full-text working set when sizing LadybugDB imports. Refs #3972. * Fix caller attribution and incomplete impact reporting (#4012) * Stabilize capped change queries and flag incomplete impact enrichment --------- Co-authored-by: Gergo Magyar <gergomagyar0@gmail.com>
22 KiB
Last reviewed: 2026-10-17
Project: GitNexus · Environment: dev · Maintainer: repository maintainers (see GitHub)
Scope
| Boundary | Rule |
|---|---|
| Reads | gitnexus/, gitnexus-web/, eval/, plugin packages, .github/, .gitnexus/, docs. |
| Writes | Only paths required for the change; keep diffs minimal. Update lockfiles when deps change. |
| Executes | npm, npx, node under gitnexus/ and gitnexus-web/; uv run for Python under eval/; documented CI/dev workflows. |
| Off-limits | Real .env / secrets, production credentials, unrelated repos, destructive git ops without confirmation. |
Model Configuration
- Primary: Use a named model (e.g. Claude Sonnet 4.x). Avoid
Autoor unversionedlatestwhen reproducibility matters. - Notes: The GitNexus CLI indexer does not call an LLM.
Execution Sequence (complex tasks)
For multi-step work, state up front:
- Which rules in this file and GUARDRAILS.md apply (and any relevant Signs).
- Current Scope boundaries.
- Which validation commands you will run (
cd gitnexus && npm test,npx tsc --noEmit).
On long threads, "Remember: apply all AGENTS.md rules" re-weights these instructions against context dilution.
Claude Code hooks
PreToolUse hooks can block tools (e.g. git_commit) until checks pass. Adapt to this repo: cd gitnexus && npm test before commit.
Context budget
Commands and gotchas live under Repo reference below and in CONTRIBUTING.md. If always-on rules grow, split into .cursor/rules/*.mdc (globs). Cursor: project-wide rules in .cursor/index.mdc. Claude Code: load STANDARDS.md only when needed.
Reference docs
- ARCHITECTURE.md, CONTRIBUTING.md, GUARDRAILS.md
- Objective-C provider work: read docs/languages/objective-c-provider.md before changing Objective-C parsing or resolution.
- Keep shared analysis code language-agnostic across ingestion, MCP tools, CLI, HTTP, and web Graph-RAG. Put language syntax, filename conventions, and semantic rules in the owning provider or format processor. Shared callers select a registered capability and handle unavailable or incomplete evidence. Register concrete implementations at the registry boundary.
- CI checks the shared tool and analysis entry points on every run and compares changed runtime code with the PR merge base. Run
GITNEXUS_LANGUAGE_BOUNDARY_BASE=origin/main npm test -- test/unit/shared-tool-language-boundary.test.tsfromgitnexus/to check the current working tree, including untracked source files. - R provider work: read docs/languages/r-provider.md and docs/languages/r-ingestion-gaps.md before changing R parsing or resolution.
- Call & inheritance resolution (RFC #909 Ring 3): See ARCHITECTURE.md § Scope-Resolution Pipeline. All languages resolve calls and inheritance through the scope-resolution pipeline (
Registry.lookup,preEmitInheritanceEdges,emitHeritageEdges,buildMro→MethodDispatchIndex). Shared code ingitnexus/src/core/ingestion/must not name languages — plug language behavior in viaLanguageProvider/ScopeResolverhooks. A language plugs in by implementingScopeResolver(scope-resolution/contract/scope-resolver.ts) and registering it inSCOPE_RESOLVERS. (The legacy call-resolution DAG +@heritagecapture path were removed in RING4-1 #942.) - Cursor:
.cursor/index.mdc(always-on);.cursor/rules/*.mdc(glob-scoped). Legacy.cursorrulesdeprecated. - GitNexus: standard skills in
.claude/skills/gitnexus-*/; MCP rules ingitnexus:startblock below.
PR Swarm Review (cross-CLI)
To run a production-readiness review of a GitNexus pull request from any AI CLI, follow
the canonical, CLI-neutral spec pr-swarm-review/orchestration.md
(seven read-only review personas under pr-swarm-review/personas/). It defines two
execution modes with the same output contract: Swarm mode (parallel subagents, e.g.
Claude Code) and Solo mode (one agent runs all lanes sequentially — Codex, Gemini,
Cursor, Copilot, or any agent reading this file). Per-CLI entrypoints are thin wrappers
listed in pr-swarm-review/README.md; edit review logic only
in the canonical files, never in the wrappers. The review is read-only — it never edits,
commits, or posts.
Engineering planning & execution (/gitnexus-plan · /gitnexus-work · /gitnexus-review · /gitnexus-lfg)
Four canonical, CLI-neutral skill specs under .claude/skills/ (Claude Code invokes
them as slash commands; Codex or any other agent reading this file should read the
named SKILL.md and follow it directly — user-level Codex prompts are documented in the
plan/work/lfg skill READMEs):
gitnexus-plan/SKILL.md— deep, implementation-ready plan for a code change: GitNexus graph intelligence for navigation, statement-level PDG slices for behavioral constraints, targeted source reads for verification. Output lands indocs/plans/with a reusable implementation context pack (section 11). Planning-only — it never edits code (index freshness refreshes viaanalyze --index-onlyare the one permitted state change). Interactive runs ask up front how deep to go (quick / standard / deep); Deepen mode strengthens an existing plan in place.gitnexus-work/SKILL.md— executes a gitnexus-plan as verified atomic commits: drift-checks the plan's evidence pin against HEAD,impactbefore every symbol edit, tests from the plan's scenarios,detect_changesbefore every commit.gitnexus-review/SKILL.md— read-only GitNexus review of a PR URL/number, branch or commit range, or local staged/unstaged/untracked changes. It pins exact SHAs, aligns the graph and checkout, runs a PDG-backed taint pass on trust-boundary diffs, scales to per-domain expert lenses from the graph's clusters (dispatched as parallel swarm lanes —ci-personas/— when the CI review agent runs it), and reports evidence-backed findings.gitnexus-lfg/SKILL.md— pipeline orchestrator: plan (depth asked up front) → blocking user gate (proceed or stop) → work →gitnexus-review.
The family ships with the npm package (gitnexus/skills/, installed to editor targets
by gitnexus setup) and the Claude Code plugin; review also has a standalone Cursor
mirror. gitnexus/test/unit/shipped-skills-sync.test.ts guards the copies. Token savings of the workflow are measurable with
eval/workflow_bench/ (real headless CLI runs, free-model routing supported — see its README).
Changelog
| Date | Version | Change |
|---|---|---|
| 2026-10-25 | 1.20.0 | Added the R ingestion gaps inventory (docs/languages/r-ingestion-gaps.md) next to the R provider guide as a required reference before changing R parsing or resolution. |
| 2026-10-17 | 1.19.0 | Added the R provider guide as the required reference before changing R parsing or resolution. |
| 2026-10-17 | 1.18.0 | Require the reviewed preview's single-use plan_token when applying semantic rename (#2973). |
| 2026-09-24 | 1.17.0 | Clones with the same origin URL now share a store automatically; --no-share records a lasting opt-out (#3352). |
| 2026-09-24 | 1.16.0 | Documented the shared worktree index store (<GITNEXUS_HOME>/stores/, analyze --share-with, GITNEXUS_SHARED_STORE=off) in the storage notes (#3352). |
| 2026-09-07 | 1.15.0 | Added the Objective-C provider guide as the required reference before changing Objective-C parsing or resolution. |
| 2026-07-20 | 1.14.0 | gitnexus-review gains a coordinated swarm: six ci-personas/ lanes the CI review agent dispatches as subagents (via the Agent tool), with a bounded critic gate and sidechain-excluded evidence. |
| 2026-07-16 | 1.13.0 | gitnexus-plan asks plan depth up front (quick/standard/deep) in interactive runs; gitnexus-lfg gate slimmed to proceed/stop (Deepen stays as the route-back mechanism). |
| 2026-07-16 | 1.12.0 | Renamed gitnexus-pr-review to gitnexus-review; added PR URL/number, branch/range, and local-change targets plus install migration (setup warns on a legacy gitnexus-pr-review dir and leaves it in place; uninstall removes it). |
| 2026-07-11 | 1.11.0 | Skill family shipped via npm skills/ + plugin (sync-guarded); added eval/workflow_bench token-savings benchmark. |
| 2026-07-11 | 1.10.0 | Added gitnexus-work (plan executor) and gitnexus-lfg (plan → deepen/work gate → review pipeline) skills; section renamed to Engineering planning & execution. |
| 2026-07-11 | 1.9.0 | Added Engineering planning (/gitnexus-plan) section; registered the gitnexus-plan skill (.claude/skills/gitnexus-plan/). |
| 2026-05-22 | 1.8.0 | Kotlin added to MIGRATED_LANGUAGES (registry-primary call resolution by default). Closes #1756 (companion-vs-instance dispatch) and #1757 (lambda scopes); refs #1746. RFC §6.4 corpus criterion waived (corpus-mode wiring is #927-scope); fixture criterion met. |
| 2026-04-23 | 1.7.0 | TypeScript added to MIGRATED_LANGUAGES (registry-primary call resolution by default). |
| 2026-04-20 | 1.6.0 | Added scope-resolution pipeline pointer (RFC #909 Ring 3); Python migrated to registry-primary. |
| 2026-04-19 | 1.5.0 | Cross-repo impact (#794): impact/query/context accept repo: "@<group>" + service. Removed group_query/group_contracts/group_status MCP tools; added gitnexus://group/{name}/contracts and gitnexus://group/{name}/status resources. |
| 2026-04-16 | 1.4.0 | Fixed: web UI description, pre-commit behavior, MCP tools (7->16), added gitnexus-shared, removed stale vite-plugin-wasm gotcha. |
| 2026-04-13 | 1.3.0 | Updated GitNexus index stats after DAG refactor. |
| 2026-03-24 | 1.2.0 | Fixed gitnexus:start block duplication. |
| 2026-03-23 | 1.1.0 | Updated agent instructions, references, Cursor layout. |
| 2026-03-22 | 1.0.0 | Initial structured header and changelog. |
GitNexus — Code Intelligence
This project is indexed by GitNexus as GitNexus (248612 symbols, 565510 relationships, 918 execution flows).
Index stale? Run
node .gitnexus/run.cjs analyze --index-onlyfrom the project root — it auto-selects an available runner. No.gitnexus/run.cjsyet? Bootstrap withnpx,bunx, orpnpm dlx— e.g.bunx gitnexus@latest analyze(npm 11 npx crash; #1939). On query/context/impact/cypher object results, read staleness.status and branch/lastCommit. Re-analyze only for behind or diverged — current is clone HEAD, not main.
Always Do
- MUST run impact analysis before editing. Use
impact({target: "symbolName", direction: "upstream"})(MCP) ornode .gitnexus/run.cjs impact "symbolName" --direction upstream --repo .(CLI fallback); report callers, processes, and risk. Never substitute grep for graph analysis. For unified PDG impact, addmode: "pdg"with optionalline: <N>— it returns statement-levelaffectedStatementsover CDG + REACHING_DEF and inter-procedural symbols ininterproceduralByDepth/byDepth; no-layer/degraded PDG results are UNKNOWN-risk notes (--pdglayer). CLI equivalent:node .gitnexus/run.cjs impact "symbolName" --direction upstream --mode pdg --line <N> --repo .. - MUST analyze changes before commit. Run
detect_changes({scope: "all"})ornode .gitnexus/run.cjs detect-changes --scope all --repo ..partial: trueortruncated: trueis not a clean check — a zero means unseen, not unaffected; re-run it. For regression review, fetch target branch "main" from its remote; compute its merge base with the reviewed HEAD and pass that SHA todetect_changes({scope: "compare", base_ref: "<merge-base SHA>"})ornode .gitnexus/run.cjs detect-changes --scope compare --base-ref "<merge-base SHA>" --repo .. - MUST warn on HIGH/CRITICAL
riskpre-edit; never useriskSharedAxesto waive a HIGH/CRITICALriskwarning. Compare File/symbol: MCP File omits axes; Graph-RAG expands File. - MUST treat
risk: UNKNOWNas unresolved, not as low. An empty caller set is not evidence the symbol is unused — it can also mean the callers are not resolvable by the index (plain-object property access, dynamic dispatch, cross-language calls).impactpairsUNKNOWNwith ariskNotesaying so. Confirm with a text search before treating the symbol as safe to change or delete; do not proceed on the strength of a zero. - MUST use
query({search_query: "concept"})for concepts/flows,context({name: "symbolName"})for a named symbol, orimpactfor blast radius, on read-only callers, dependencies, imports, or execution flow. Graph first; text search only for empty/UNKNOWN/literals. - For security review,
explain({target: "fileOrSymbol"})lists taint findings (source→sink flows; needsanalyze --pdg). - For control/data dependence,
pdg_query({mode: "controls", target: "fileOrSymbol"})answers "under what condition does X run?" (CDG, incl. guard clauses) andpdg_query({mode: "flows", target, variable})traces "where does variable Y flow?" (REACHING_DEF).--pdglayer.
Never Do
- NEVER edit a function, class, or method before MCP/CLI impact analysis.
- NEVER ignore HIGH or CRITICAL risk warnings from impact analysis, and never read
UNKNOWNas an all-clear — it means the walk could not answer, which is the one verdict that requires confirming by other means. - NEVER rename symbols with find-and-replace — use
renamewithdry_run: truefirst, review the graph-backed semantic spans and coverage, then apply withdry_run: falseand that preview'splan_token. - NEVER commit before MCP/CLI graph change analysis.
Resources
| Resource | Use for |
|---|---|
gitnexus://repo/GitNexus/context |
Codebase overview, check index freshness |
gitnexus://repo/GitNexus/clusters |
All functional areas |
gitnexus://repo/GitNexus/processes |
All execution flows |
gitnexus://repo/GitNexus/process/{name} |
Step-by-step execution trace |
CLI
| Task | Read this skill file |
|---|---|
| Understand architecture / "How does X work?" | .claude/skills/gitnexus-exploring/SKILL.md |
| Blast radius / "What breaks if I change X?" | .claude/skills/gitnexus-impact-analysis/SKILL.md |
| Trace bugs / "Why is X failing?" | .claude/skills/gitnexus-debugging/SKILL.md |
| Rename / extract / split / refactor | .claude/skills/gitnexus-refactoring/SKILL.md |
| Tools, resources, schema reference | .claude/skills/gitnexus-guide/SKILL.md |
| Index, status, clean, wiki CLI commands | .claude/skills/gitnexus-cli/SKILL.md |
Repo reference
Packages
| Package | Path | Purpose |
|---|---|---|
| CLI/Core | gitnexus/ |
TypeScript CLI, indexing pipeline, MCP server. Published to npm. |
| Web UI | gitnexus-web/ |
React/Vite thin client. All queries via gitnexus serve HTTP API. |
| Shared | gitnexus-shared/ |
Shared TypeScript types and constants. |
| Claude Plugin | gitnexus-claude-plugin/ |
Static config for Claude marketplace. |
| Cursor Integration | gitnexus-cursor-integration/ |
Static config for Cursor editor. |
| Eval | eval/ |
Python evaluation harness (Docker + LLM API keys). |
Running services
cd gitnexus && npm run dev # CLI: tsx watch mode
cd gitnexus-web && npm run dev # Web UI: Vite on port 5173
npx gitnexus serve # HTTP API on port 4747 (from any indexed repo)
Testing
CLI / Core (gitnexus/)
npm test— full vitest suite (~2000 tests)npm run test:unit— unit tests onlynpm run test:integration— integration (~1850 tests). LadybugDB file-locking tests may fail in containers (known env issue).npx tsc --noEmit— typecheck
Web UI (gitnexus-web/)
npm test— vitest (~200 tests)npm run test:e2e— Playwright (7 spec files; requiresgitnexus serve+npm run dev)npx tsc -b --noEmit— typecheck
Pre-commit hook (.husky/pre-commit): formatting (prettier via lint-staged) + typecheck for staged packages. Tests do not run in pre-commit — CI only.
Gotchas
npm installingitnexus/triggersprepare(builds viatsc) andpostinstall(build-tree-sitter-grammars.cjsactivates committed prebuilds in place undervendor/, and only source-builds when none matches). A C/C++ toolchain (python3,make,g++) is needed only for that source-build fallback.- The vendored grammars
tree-sitter-{c,dart,proto,swift,kotlin,zig}are handled uniformly: c is required; dart/proto/swift/kotlin/zig are optional and skippable viaGITNEXUS_SKIP_OPTIONAL_GRAMMARS=1. Install warnings appear only when no prebuild matches the platform-arch and no toolchain is present, and are non-fatal — only that language's parsing is unavailable. - ESLint configured via
eslint.config.mjs(TS, React Hooks, unused-imports). Nonpm run lintscript; usenpx eslint .. Prettier runs via lint-staged. CI checks both inci-quality.yml. - Index storage defaults to
<repo>/.gitnexus/.GITNEXUS_STORAGE_PATHselects one complete external index directory and wins overGITNEXUS_STORAGE_ROOT, which creates an isolated<repo-basename>-<12-hex>/slot per repository. Linked worktrees share one store under<GITNEXUS_HOME>/stores/<key>/(one immutable graph per commit, private graphs for checkouts with local changes, shared parse caches); clones with the sameoriginURL join a registered sibling's store automatically (analyze --share-withnames one,--no-shareopts out and is remembered), andGITNEXUS_SHARED_STORE=offor either storage env var disables sharing (#3352).GITNEXUS_CONTENT_RETENTIONisfull(default),symbol, ornone. MCPlist_repos,gitnexus://repo/{name}/context, and HTTPGET /api/repos/GET /api/repoexposestoragePath,contentRetention, andsourceAvailable. HTTP/api/fileand/api/grepreturn 410 unless retention isfull; MCPinclude_contentmay still return symbol spans atsymbol.