GitNexus Bridge: This skill uses GitNexus for AST-based analysis and call graph extraction. It works in Lite mode (regex-based) without GitNexus, but Full mode requires GitNexus installed.
When to use
Run code index when you need to:- Enrich code references with precise symbol-level data (no regex heuristic)
- Map call graphs to SDD artifacts for blast radius analysis
- Detect uncovered execution paths (public symbols with no SDD refs)
- Infer transitive artifact relationships from call graph
- Enable code intelligence features in dashboard, req-change, traceability-check, and reconcile
- Connect GitNexus execution flows to SDD workflows
Invocation
Modes
| Mode | Description | Requirements |
|---|---|---|
| Full (default) | Full GitNexus analysis + SDD mapping with call graph and transitive inference | GitNexus installed |
| Lite | Enhanced regex-based analysis without AST/call graph | None |
| Status | Check if code index is current, report staleness | Existing code index |
| Refresh | Re-run only for files changed since last index | Existing code index + git |
Prerequisites
- A project with source code in
src/(or configurable root) - Existing SDD artifacts (at least
requirements/andspec/) dashboard/traceability-graph.jsongenerated by/sdd:dashboard- Optional (for Full mode): GitNexus installed (
npm install -g gitnexus)
If
traceability-graph.json doesn’t exist, the skill will direct you to run /sdd:dashboard first.How it works
Phase 1: Environment check
- Verify
dashboard/traceability-graph.jsonexists (STOP if missing → suggest/sdd:dashboard) - Check GitNexus availability via
npx gitnexus --version- If available: proceed with Full mode
- If not available AND mode is Full: present option table (Install GitNexus / Use Lite mode / Cancel)
- Read current
traceability-graph.jsoninto memory
Phase 2: Code analysis (Full mode — GitNexus)
- Run GitNexus analysis:
npx gitnexus analyze - Query GitNexus MCP for all exported symbols:
- Use
gitnexus_query({ query: "all exported functions and classes" }) - Collect: name, type, filePath, startLine, endLine, isExported
- Use
- For each symbol, query context:
- Use
gitnexus_context({ name: symbolName })→ callers, callees, processes
- Use
- Scan each symbol’s source location for
Refs:annotations:- Search backward up to 10 lines for
// Refs:or# Refs:comments - Extract artifact IDs (REQ-, UC-, INV-*, etc.)
- Search backward up to 10 lines for
Phase 3: Code analysis (Lite mode — Regex)
- Scan
src/**/*.{ts,js,tsx,jsx,py,java,go,rs,cs,rb}for:- Function/class/method declarations (regex per language)
Refs:annotation comments within 10 lines
- Build symbol table: name, type, filePath, startLine (no callers/callees/processes)
- Mark all refs as
direct(no inference possible without call graph)
Phase 4: SDD mapping
-
For each symbol with
Refs:annotations:- Map referenced artifact IDs to the traceability graph
- Create
artifactRefs[]entries on the symbol
-
Transitive inference (Full mode only):
- For each annotated symbol, walk its callers (from GitNexus call graph)
- For each caller WITHOUT its own
Refs:annotation:- Infer that the caller implements the same artifacts
- Add to
inferredRefs[]with flaginferred: true - Propagation depth: max 2 levels (caller of caller)
-
Process mapping (Full mode only):
- For each GitNexus execution flow/process:
- Collect all artifact refs from steps in the flow
- Map process to SDD artifacts
- Create
processes[]entries
- For each GitNexus execution flow/process:
-
Community detection (Full mode only):
- Group symbols by their GitNexus community assignments
- Map communities to SDD business domains (from classification)
Phase 5: Graph enrichment
BuildcodeIntelligence block for traceability-graph.json:
- For symbols with
inferredRefs, add new codeRef entries to target artifacts - Set
inferred: trueflag (schema v4 extension) - Add new relationships:
inferred-implementswith confidence score - Update
statistics.codeStatswith enriched counts
Phase 6: Write & report
-
Write updated
dashboard/traceability-graph.json- Bump
$schemato"traceability-graph-v4"if codeIntelligence added - Preserve all existing data (backward compatible)
- Bump
- Generate enrichment report:
- Output report to
code-intelligence/CODE-INDEX-REPORT.md
Output artifacts
| Artifact | Location | Description |
|---|---|---|
| Enriched graph | dashboard/traceability-graph.json | Updated with codeIntelligence block (schema v4) |
| Index report | code-intelligence/CODE-INDEX-REPORT.md | Enrichment summary and recommendations |
Integration with other skills
| Skill | How it uses code index |
|---|---|
/sdd:dashboard | Renders code intelligence tab, enriched code coverage view with symbol table and processes |
/sdd:req-change | Uses call graph for blast radius in Phase 2 Step 8 (d=1: WILL_BREAK, d=2: LIKELY_AFFECTED, d=3: MAY_NEED_REVIEW) |
/sdd:traceability-check | Verifies code/test chain integrity in Step 5.5 (validates codeRef existence, detects orphaned annotations, uncovered paths) |
/sdd:reconcile | Uses symbol table for code scan in Phase 2 (scalable via MCP instead of manual file-by-file reading) |
/sdd:reverse-engineer | Can consume existing code index to accelerate analysis |
Constraints
- C-01: Never modify source code files (no auto-injection of Refs: comments)
- C-02: Transitive inference max depth = 2 (beyond 2 levels, confidence too low)
- C-03: Confidence threshold for inferred refs = 0.7 (below this, mark as “suggested” not “inferred”)
- C-04: GitNexus is optional — the skill MUST work in Lite mode without it
- C-05: Preserve all existing graph data — the codeIntelligence block is additive only
- C-06: If traceability-graph.json doesn’t exist, direct user to
/sdd:dashboardfirst
Example workflow
First-time setup
After code changes
Without GitNexus
Related skills
Dashboard
Visualize code intelligence data
Requirements Change
Symbol-level blast radius analysis
Traceability Check
Verify code/test chain integrity
Reconcile
Scalable code scan via MCP