gitnexus-stable-ops

July 31, 2026 · View on GitHub

Give AI Agents a 360° View of Your Codebase.

Stop Copilot and Claude Code from breaking callers they don't know about. gitnexus-stable-ops is a production ops toolkit that keeps GitNexus running reliably across 25+ repositories — zero embedding loss, zero version drift, zero dirty-graph surprises.

CI Stars License: MIT Featured in GitNexus

"designed for autonomous agent swarms"@d3thshot7777, GitNexus maintainer

Powering 39+ OpenClaw Agents · 14 upstream PRs → 7 merged · 3+ months production

English | 中文 | 日本語


Quick Start

git clone https://github.com/ShunsukeHayashi/gitnexus-stable-ops.git
cd gitnexus-stable-ops && make install

# Diagnose a repo
bin/gitnexus-doctor.sh ~/dev/my-repo my-repo MyClassName

# Smart reindex (skips if up-to-date, protects embeddings)
REPO_PATH=~/dev/my-repo bin/gitnexus-auto-reindex.sh

# See what breaks if you change a class
gni impact AuthService
✅ Direct callers (d=1):  UserController.login, SessionManager.refresh
⚠️  Transitive deps (d=2): 14 files affected
🔴 Risk: HIGH — update callers before merging

Why This Exists

GitNexus is one of the most capable open-source code intelligence engines available today. But running it in production — across dozens of repositories, with automated reindexing, inside AI agent workflows — exposes four critical operational problems:

ProblemImpactThis toolkit's fix
Version driftCLI and MCP reference different versions, causing data corruptionPinned binary ($GITNEXUS_BIN) used by all scripts
Embedding lossanalyze --force silently deletes embeddingsAuto-detect existing embeddings, add --embeddings flag automatically
Dirty worktreeReindexing uncommitted work pollutes the code graphSkip dirty repos by default (ALLOW_DIRTY_REINDEX=0)
Impact instabilityimpact crashes on arm64 macOS with concurrent queriesGraceful fallback to context-based analysis

We discovered and solved these problems running GitNexus on 25+ repos for 3+ months.


Production Stats

MetricValue
Repositories indexed25+
Symbols in knowledge graph32,000+
Edges (relationships)73,000+
AI agents using the graph40 (OpenClaw MAS)
Embedding loss incidents0 since v1.0
Upstream PRs merged to GitNexus7 of 14 submitted
Production uptime3+ months

How AI Agents Use This

Agent receives task: "Fix auth bug in service-api"
    |
    +-- 1. gni impact AuthService   --> What breaks if we change it?
    +-- 2. gni context AuthService  --> Get callers, callees, dependencies
    +-- 3. Agent writes code fix
    +-- 4. auto-reindex.sh          --> Graph stays current (post-commit hook)

Key insight: When AI agents share a code knowledge graph, they avoid breaking callers they don't know about. gni impact is the difference between a safe refactor and a 2 AM incident.

# Example: OpenClaw 39-agent system
steps:
  - agent: dev-architect
    action: gni impact TargetClass --direction upstream
    purpose: Blast radius before code change

  - agent: dev-coder
    action: gni context TargetClass
    purpose: Understand dependencies before writing fix

  - trigger: post-commit hook
    action: gitnexus-auto-reindex.sh
    purpose: Graph stays current for the next agent

Features

ScriptPurpose
bin/gniProduction CLI wrapper — readable output, cypher stderr capture, impact fallback
bin/gitnexus-doctor.shDiagnose version drift, index health, MCP config, embedding status
bin/gitnexus-smoke-test.shEnd-to-end health check (analyze → status → list → context → cypher → impact)
bin/gitnexus-safe-impact.shImpact analysis with automatic context-based fallback on failure
bin/gitnexus-auto-reindex.shSmart single-repo reindex (stale detection + embedding protection + dirty skip)
bin/gitnexus-reindex.shBatch reindex recently changed repos (cron-friendly)
bin/gitnexus-reindex-all.shReindex all registered repos with safety defaults
bin/gitnexus-install-hooks.shInstall git hooks for auto-reindex on commit/merge

Safety Defaults

FeatureDefaultOverride
Embedding protectionAuto-detect and preserveAlways on
Dirty worktree skipSkip dirty reposALLOW_DIRTY_REINDEX=1
Impact fallbackContext-based JSON on failureAlways on
Version pinning$GITNEXUS_BINSet env var

Environment Variables

VariableDefaultPurpose
GITNEXUS_BIN~/.local/bin/gitnexus-stablePinned GitNexus CLI path
REGISTRY_PATH~/.gitnexus/registry.jsonIndexed repo registry
ALLOW_DIRTY_REINDEX0Allow reindexing dirty worktrees
REPOS_DIR~/devRoot directory for batch reindex
LOOKBACK_HOURS24How far back to check for changes

Edge Cases & Lessons Learned

After 3 months of production use:

Edge caseStatusNotes
LadybugDB concurrent query lock errors✅ Fixed upstream PR #425 + local fallbackUse gitnexus-safe-impact.sh for older versions
Embedding silent deletion on --force✅ Zero incidents since v1.0Auto-detects meta.json, adds --embeddings
Version drift between CLI and MCP✅ Pinned binaryAll scripts use $GITNEXUS_BIN
Dirty worktree graph pollution✅ Skipped by defaultOverride: ALLOW_DIRTY_REINDEX=1
Large monorepo heap exhaustion✅ Detected and logged clearlySet NODE_OPTIONS=--max-old-space-size=8192

▶ Agent Context Graph (v1.3.0) — Index agents, skills, and cluster topology

Beyond code symbols, gitnexus-stable-ops indexes agent-level entities from your workspace — giving LLMs a live map of who can do what and where.

What it indexes

EntitySourceDescription
AgentKNOWLEDGE/AGENTS_*.md frontmatterNamed agents with roles, pane IDs, society membership
SkillSKILL/**/*.mdSkills with priority, keywords, script paths
KnowledgeDocKNOWLEDGE/**/*.mdReference docs and context files
MemoryDocMEMORY/**/*.mdSession memories and daily logs
ComputeNodeworkspace.json nodes[]Physical/virtual machines in your cluster
WorkspaceServiceworkspace.json services[]Deployed agents/services with model info

Progressive Disclosure

LevelTokensUse case
--level 1~100LLM system prompt overview
--level 2~400Default context injection
--level 3~2000Deep dive with full edges
# Build the agent graph
gni agent-index ~/dev/MY_WORKSPACE --force

# Query at different detail levels
gni aq "deploy agent"   --level 1
gni aq "cc-hayashi"     --level 2
gni aq "announce skill" --level 3

# Auto-generate CLAUDE.md / AGENTS.md
gni cg . --update

For the full guide, see docs/agent-context-graph.md.


▶ Production Deployment — Docker and cron setup

Docker

FROM node:22-slim
RUN npm install -g gitnexus@1.4.6
RUN git clone https://github.com/ShunsukeHayashi/gitnexus-stable-ops.git /opt/stable-ops \
    && cd /opt/stable-ops && make install
RUN ln -sf $(which gitnexus) /usr/local/bin/gitnexus-stable
ENV GITNEXUS_BIN=/usr/local/bin/gitnexus-stable
ENV REPOS_DIR=/repos
COPY crontab /etc/cron.d/gitnexus
CMD ["cron", "-f"]

Cron schedule

# Smart reindex: only repos changed in last 24h
0 3 * * *  REPOS_DIR=/repos bin/gitnexus-reindex.sh >> /var/log/gitnexus-reindex.log
# Weekly full reindex (Sunday 4 AM)
0 4 * * 0  bin/gitnexus-reindex-all.sh >> /var/log/gitnexus-full-reindex.log
# Health check (daily)
30 9 * * * bin/gitnexus-doctor.sh /repos/main-app main-app >> /var/log/gitnexus-doctor.log

For the full CI/CD guide, see docs/ci-cd-integration.md.


Upstream Contributions

PRTitleStatus
#441Add confidence constant for similarity threshold✅ Merged
#451Persist chat history across sessions✅ Merged
#453Add structured debug logger✅ Merged
#454detect_changes — classify by change type✅ Merged
#425Fix LadybugDB concurrent lock errors with exponential backoff✅ Merged
#455Align QueryResult types with LadybugDB WASM API🔄 Review
#458Expose per-repo resources in resources/list (fix MCP discovery)🔄 Review
#443Add maxIterations to prevent runaway agent loops🔄 Review
(+6 more)Error handling, performance, CI stability🔄 Review

Compatibility

PlatformStatus
macOS (Apple Silicon)✅ Primary development platform
Linux (Ubuntu, Debian, Fedora)✅ Tested
Docker✅ See deployment section above
Windows⚠️ Use WSL or Git Bash

Requires: Bash 4.0+ · Git 2.0+ · jq 1.6+ · Python 3.6+ · Node.js 20+


Documentation

Contributing

Contributions welcome! See CONTRIBUTING.md.

All contributions must include tests, follow Conventional Commits, and pass make test.


Enterprise

Running GitNexus at scale in a regulated environment? Miyabi G.K. offers architecture review, custom CI/CD integration, and priority issue resolution.

📧 shunsuke.hayashi@miyabi-ai.jp 🐦 @The_AGI_WAY


License

This toolkit: MIT — covers wrapper scripts, tooling, and documentation only.

GitNexus itself is licensed under PolyForm NonCommercial 1.0.0. This toolkit calls the GitNexus CLI but does not include or redistribute any GitNexus source code. For commercial use, verify GitNexus licensing independently.


Built by Miyabi G.K.

🐦 @The_AGI_WAY · 📧 shunsuke.hayashi@miyabi-ai.jp

Active contributor to GitNexus — 14 PRs submitted, 7 merged.