Multi-Repository Projects¶
Nexus-Dev supports multi-repository project setups where a parent folder contains the nexus configuration and multiple sub-folders contain independent git repositories.
Overview¶
In a multi-repository (mono-repo style) project, you might have:
/artemis-coach/ # Parent folder (no .git)
├── nexus_config.json # Single configuration
├── .nexus/
│ └── lessons/ # Centralized lessons
├── frontend/ # Sub-repository
│ └── .git/
├── backend/ # Sub-repository
│ └── .git/
└── shared/ # Sub-repository
└── .git/
All repositories share:
- Single project ID - One knowledge base for the entire project
- Centralized lessons - All lessons stored in parent .nexus/lessons/
- Unified indexing - Changes in any repo index to the same database
Setup¶
Step 1: Initialize Parent Project¶
From the parent directory:
This creates:
- nexus_config.json - Project configuration
- .nexus/lessons/ - Centralized lesson storage
- Database in ~/.nexus-dev/db/
Step 2: Install Hooks in Sub-Repositories¶
You have two options:
Option A: Manual Installation (Per Repository)¶
Install hooks one at a time:
cd frontend
nexus-init --link-hook
cd ../backend
nexus-init --link-hook
cd ../shared
nexus-init --link-hook
Output:
✅ Installed pre-commit hook (linked to artemis-coach/)
✅ Linked to parent project: Artemis Coach
Project ID: artemis-coach_abc123
Project Root: /path/to/artemis-coach
Option B: Auto-Discovery (All Repositories)¶
Install hooks in all sub-repositories at once:
Output:
Found 3 git repositories:
📁 frontend
📁 backend
📁 shared
Install hooks in all repositories? [y/N]: y
✅ frontend
✅ backend
✅ shared
✅ Installed hooks in 3/3 repositories
All repositories linked to project: Artemis Coach
How It Works¶
Project Root Discovery¶
The pre-commit hook automatically discovers the project root by walking up the directory tree to find nexus_config.json:
- Hook executes in sub-repository (e.g.,
frontend/) - Walks up:
frontend/→artemis-coach/→ findsnexus_config.json - Changes to project root for indexing
- All files indexed to parent project database
Indexing Behavior¶
When you commit in a sub-repository:
The hook:
1. Finds parent nexus_config.json
2. Indexes frontend/src/App.tsx to parent project
3. Uses parent project ID for storage
4. All changes searchable via search_code() and search_knowledge()
Best Practices¶
Centralized Lessons¶
Store all lessons in the parent .nexus/lessons/ folder:
/artemis-coach/.nexus/lessons/
├── lesson_001.md # Frontend lesson
├── lesson_002.md # Backend lesson
└── lesson_003.md # Integration lesson
Single Source of Truth¶
- Keep
nexus_config.jsononly at the parent level - Don't create separate configs in sub-repositories
- Sub-repositories automatically link to parent configuration
Workflows¶
Use workflows from the parent directory:
All nexus-dev MCP tools work across all repositories:
- search_code() - Searches all indexed code
- record_lesson() - Stores in parent .nexus/lessons/
- get_project_context() - Shows stats across all repos
Troubleshooting¶
Hook Not Finding Config¶
If the hook reports "No nexus_config.json found":
-
Verify parent config exists:
-
Check hook was installed correctly:
Should contain project root discovery logic starting with REPO_ROOT=$(git rev-parse --show-toplevel)
- Reinstall hook:
Files Not Indexing¶
Check that the hook is executable:
If not:
Verify Project ID¶
Ensure all repositories use the same project ID:
cd /path/to/artemis-coach
nexus-status # Shows project ID
cd frontend
git commit --allow-empty -m "test"
# Hook output should show parent project root
Migration from Separate Configs¶
If you previously had separate nexus_config.json files in each sub-repository:
-
Backup data:
-
Remove sub-repo config:
-
Link to parent:
-
Re-index from parent:
Related Documentation¶
- CLI Reference: nexus-init - Full CLI options
- Installation Guide - Initial setup