Rules for human contributors and AI agents working on this codebase or publishing artifacts. These complement AGENTS.md / CLAUDE.md (which focus on GitNexus-in-GitNexus workflows).
When automating changes in this repository, treat scope as least privilege:
- Read: Source, tests, docs, public config as needed for the task.
- Write: Only files required for the requested fix or feature; avoid unrelated formatting or refactors.
- Execute: Tests, typecheck, and documented CLI commands; do not run destructive commands on user data outside the repo without explicit approval.
- Off-limits: Other people’s machines, production deployments you don’t own, and credentials you didn’t receive permission to use.
Adjust explicitly if the maintainer defines a different scope for a task.
- Never commit secrets — API keys, tokens,
.envwith real values, private URLs, or session cookies. Use.env.examplewith placeholders only. - Never rename symbols with blind find-and-replace when working in a GitNexus-indexed project — use the
renameMCP tool withdry_run: truefirst, then reviewgraphvstext_searchedits. (There is no separategitnexus renameCLI; renaming goes through MCP or editor integration.) - Run impact analysis before editing shared symbols — use
impact(upstream) for functions/classes/methods others call; do not ignore HIGH / CRITICAL risk without maintainer sign-off. - Prefer
detect_changesbefore commit — confirm diffs map to expected symbols/processes when the graph is available. - Preserve embeddings — if
.gitnexus/meta.jsonshows embeddings, runnpx gitnexus analyze --embeddingswhen refreshing the index; plainanalyzecan drop them.
Use this format: Trigger → Instruction → Reason.
Append new Signs here when the same mistake repeats (e.g. CI broken twice the same way).
- Trigger: MCP or resources warn the index is behind
HEAD, or code search doesn’t match latest commit. - Instruction: Run
npx gitnexus analyzefrom the repo root (plus--embeddingsif the project used them). - Reason: Tools query LadybugDB built at last analyze; git changes are invisible until re-indexed.
- Trigger: Semantic search quality drops;
stats.embeddingsin.gitnexus/meta.jsonis 0 after a refresh. - Instruction: Re-run
npx gitnexus analyze --embeddingsand confirmmeta.jsonreflects stored embeddings. - Reason: Embedding generation is opt-in; analyze without the flag does not preserve prior vectors.
- Trigger: MCP stderr says no indexed repos.
- Instruction: Run
npx gitnexus analyzein the target repository; verifynpx gitnexus listshows it. - Reason: The MCP server discovers repos via
~/.gitnexus/registry.json, populated by analyze.
- Trigger: Query/impact results clearly belong to another project.
- Instruction: Call
list_repos, then passrepoon subsequent tools (or use per-workspace MCP config). - Reason: Default target may be ambiguous when multiple repos are registered.
- Trigger: Errors opening
.gitnexus/lbugwhile MCP and analyze both run. - Instruction: Stop overlapping processes; one writer at a time. Retry analyze or restart MCP.
- Reason: Embedded DB expects single-process ownership of the store.
- npm: Do not publish from unreviewed automation; follow maintainer release process. Bump version intentionally; tag releases to match
package.json. - Dependencies: Prefer minimal, auditable changes to
package.json; run tests and CI after lockfile updates. - License: This project ships under PolyForm Noncommercial 1.0.0 — do not relicense or imply a different license in docs or metadata without maintainer approval.
Stop and ask a human maintainer when:
- Impact analysis shows HIGH / CRITICAL risk and the task still requires the change.
- You need to alter CI, release, or security-sensitive config.
- Requirements conflict (e.g. “speed up analyze” vs “must keep all embeddings on huge repo”).
- You are unsure whether data loss is acceptable (
clean, forced migrations, schema changes).
- ARCHITECTURE.md — components and data flow.
- RUNBOOK.md — commands for recovery.
- CONTRIBUTING.md — PR and commit expectations.