repo-nexus 0.3.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -8
- package/docs/AGENTS.sample.md +7 -5
- package/package.json +1 -1
- package/rnex +140 -49
- package/toolkit/plugins/karpathy-llm/README.md +12 -9
- package/toolkit/plugins/karpathy-llm/instructions/karpathy-llm.md +85 -0
- package/toolkit/plugins/karpathy-llm/plugin.yaml +2 -0
- package/toolkit/prompts/setup-karpathy-wiki.md +10 -9
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[](#)
|
|
8
8
|
[](docs/FAQ.md)
|
|
9
9
|
|
|
10
|
-
A **simple, lightweight companion tool** for multi-repo workflows. It links multiple independent repositories and shares universal AI instructions (like `AGENTS.md`) using standard Unix symlinks
|
|
10
|
+
A **simple, lightweight companion tool** for multi-repo workflows. It links multiple independent repositories and shares universal AI instructions (like `AGENTS.md`) using standard Unix symlinks **without Git submodules, monorepo migrations, or complex setup**.
|
|
11
11
|
|
|
12
12
|
- **No Git Submodules or Nested Git Friction**: Keep your repositories completely independent. No detached HEADs, no `.gitmodules`, and no merge conflicts between repos.
|
|
13
13
|
- **A Lean Companion, Not a Workspace Replacer**: It does not replace your editor, terminal, build tools, or package manager. It is a tiny (~20 KB) helper that seamlessly complements your existing workflow.
|
|
@@ -93,22 +93,25 @@ A **simple, lightweight companion tool** for multi-repo workflows. It links mult
|
|
|
93
93
|
|
|
94
94
|
## Installation
|
|
95
95
|
|
|
96
|
-
Install `rnex` via npm,
|
|
96
|
+
Install `rnex` via npm, standalone one-liner (`curl` / `wget`), or from source:
|
|
97
97
|
|
|
98
|
-
### Option 1: Via npm (
|
|
98
|
+
### Option 1: Via npm (Global)
|
|
99
99
|
|
|
100
100
|
```bash
|
|
101
101
|
npm install -g repo-nexus
|
|
102
102
|
```
|
|
103
|
-
*(Installs both `repo-nexus` and `rnex` commands globally, or run via `npx repo-nexus init`)*
|
|
103
|
+
*(Installs both `repo-nexus` and `rnex` commands globally, or run without installing via `npx repo-nexus init`)*
|
|
104
104
|
|
|
105
|
-
### Option 2:
|
|
105
|
+
### Option 2: Standalone One-Liner (curl / wget — Zero Dependencies, No Node.js)
|
|
106
106
|
|
|
107
107
|
```bash
|
|
108
|
-
|
|
108
|
+
curl -fsSL https://raw.githubusercontent.com/nu-nenoi/repo-nexus/main/scripts/install.sh | sh
|
|
109
|
+
# or
|
|
110
|
+
wget -qO- https://raw.githubusercontent.com/nu-nenoi/repo-nexus/main/scripts/install.sh | sh
|
|
109
111
|
```
|
|
112
|
+
*(Downloads and links `rnex` and `repo-nexus` into `~/.local/bin` without requiring Node.js or npm)*
|
|
110
113
|
|
|
111
|
-
### Option 3: Native Installer (
|
|
114
|
+
### Option 3: Native Installer (Clone & Install)
|
|
112
115
|
|
|
113
116
|
Clone the repository and run the built-in installer:
|
|
114
117
|
|
|
@@ -144,7 +147,7 @@ rnex add frontend ../web-app # relative paths work too
|
|
|
144
147
|
rnex status
|
|
145
148
|
```
|
|
146
149
|
|
|
147
|
-
During `rnex init`, the CLI
|
|
150
|
+
During `rnex init`, the CLI creates `rnex.yaml` if none exists for the directory, and merges Repo Nexus workspace instructions with any existing AI instructions (such as `AGENTS.md`, `CLAUDE.md`, `.cursorrules`).
|
|
148
151
|
|
|
149
152
|
---
|
|
150
153
|
|
package/docs/AGENTS.sample.md
CHANGED
|
@@ -4,8 +4,10 @@ This workspace operates as a **Repo Nexus** linking multiple independent reposit
|
|
|
4
4
|
|
|
5
5
|
## Rules for AI Coding Assistants
|
|
6
6
|
|
|
7
|
-
1. **
|
|
8
|
-
2. **
|
|
9
|
-
3. **
|
|
10
|
-
4. **
|
|
11
|
-
5. **
|
|
7
|
+
1. **Workspace Structure & Settings**: AI coding assistants MUST inspect and read `rnex.yaml` at the workspace root to understand the workspace structure (such as `repos_dir`), registered member repositories, and active configuration settings.
|
|
8
|
+
2. **Symlink Write-Through**: Files edited under `repos/<name>/` directly modify the target repository.
|
|
9
|
+
3. **Repo Boundaries**: Each repository is isolated. Do not introduce cross-repo imports unless explicitly architected.
|
|
10
|
+
4. **Shared Context**: This file governs AI assistant behavior across all member repositories. Keep instructions universal. Use local instructions for repo-specific rules.
|
|
11
|
+
5. **Member Repo RNEX Context**: Member repositories may contain an `.rnex/` directory (accessible via `repos/<name>/.rnex/`) containing repository-specific documents, instructions, rules, workflows, and scripts managed by Repo Nexus. AI assistants operating at the workspace level MUST inspect `repos/<name>/.rnex/` for member-specific context, guidelines, and commands.
|
|
12
|
+
6. **Plugin Instructions**: If plugins are enabled in `rnex.yaml` (under `plugins:`), AI coding assistants MUST read instructions for each enabled plugin from its separate instruction files (located in `.rnex/instructions/` or `.rnex/rules/`).
|
|
13
|
+
7. **Git Operations**: Commit and push changes directly within the respective member repository root.
|
package/package.json
CHANGED
package/rnex
CHANGED
|
@@ -559,12 +559,13 @@ plugin_list_rules() {
|
|
|
559
559
|
_pdir="$1"
|
|
560
560
|
[ -f "$_pdir/plugin.yaml" ] || return 0
|
|
561
561
|
awk '
|
|
562
|
-
/^rules
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
sub(
|
|
567
|
-
|
|
562
|
+
/^(rules|instructions|ai_files):[ ]*(#.*)?$/ { in_sec = 1; next }
|
|
563
|
+
in_sec && /^[^ #]/ { in_sec = 0 }
|
|
564
|
+
in_sec && /^[ ]*-[ ]*/ {
|
|
565
|
+
line = $0
|
|
566
|
+
sub(/^[ ]*-[ ]*/, "", line)
|
|
567
|
+
sub(/[ ]*#.*/, "", line)
|
|
568
|
+
if (length(line) > 0) print line
|
|
568
569
|
}
|
|
569
570
|
' "$_pdir/plugin.yaml"
|
|
570
571
|
}
|
|
@@ -641,53 +642,113 @@ sync_plugins() {
|
|
|
641
642
|
done
|
|
642
643
|
}
|
|
643
644
|
|
|
644
|
-
#
|
|
645
|
-
# Commands
|
|
646
|
-
# ============================================================================
|
|
647
|
-
|
|
648
|
-
cmd_init() {
|
|
649
|
-
_target_dir="${1:-$PWD}"
|
|
650
|
-
_target_dir="$(resolve_path "$_target_dir")"
|
|
651
|
-
mkdir -p "$_target_dir"
|
|
652
|
-
|
|
653
|
-
_target_yaml="$_target_dir/$RNEX_CONFIG_FILE"
|
|
645
|
+
# ---- AI Instructions Management -------------------------------------------
|
|
654
646
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
log_dim "To reconcile symlinks and plugins, run:"
|
|
658
|
-
log_dim " rnex sync"
|
|
659
|
-
return 0
|
|
660
|
-
fi
|
|
647
|
+
AI_MARKER_START="<!-- REPO-NEXUS:START -->"
|
|
648
|
+
AI_MARKER_END="<!-- REPO-NEXUS:END -->"
|
|
661
649
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
if [ ! -f "$_target_agents" ]; then
|
|
665
|
-
_script_dir="$(dirname "$SCRIPT_LOCATION")"
|
|
666
|
-
_sample="$_script_dir/docs/AGENTS.sample.md"
|
|
667
|
-
if [ -f "$_sample" ]; then
|
|
668
|
-
cp "$_sample" "$_target_agents"
|
|
669
|
-
log_ok "Created AGENTS.md from sample template"
|
|
670
|
-
else
|
|
671
|
-
cat <<'AGENTS_EOF' > "$_target_agents"
|
|
650
|
+
get_rnex_instructions() {
|
|
651
|
+
cat <<'AGENTS_EOF'
|
|
672
652
|
# Multi-Repo AI Workspace Context
|
|
673
653
|
|
|
674
654
|
This workspace operates as a **Repo Nexus** linking multiple independent repositories via symlinks.
|
|
675
655
|
|
|
676
656
|
## Rules for AI Coding Assistants
|
|
677
657
|
|
|
678
|
-
1. **
|
|
679
|
-
2. **
|
|
680
|
-
3. **
|
|
681
|
-
4. **
|
|
658
|
+
1. **Workspace Structure & Settings**: AI coding assistants MUST inspect and read `rnex.yaml` at the workspace root to understand the workspace structure (such as `repos_dir`), registered member repositories, and active configuration settings.
|
|
659
|
+
2. **Symlink Write-Through**: Files edited under `repos/<name>/` directly modify the target repository.
|
|
660
|
+
3. **Repo Boundaries**: Each repository is isolated. Do not introduce cross-repo imports unless explicitly architected.
|
|
661
|
+
4. **Shared Context**: This file governs AI assistant behavior across all member repositories. Keep instructions universal. Use local instructions for repo-specific rules.
|
|
662
|
+
5. **Member Repo RNEX Context**: Member repositories may contain an `.rnex/` directory (accessible via `repos/<name>/.rnex/`) containing repository-specific documents, instructions, rules, workflows, and scripts managed by Repo Nexus. AI assistants operating at the workspace level MUST inspect `repos/<name>/.rnex/` for member-specific context, guidelines, and commands.
|
|
663
|
+
6. **Plugin Instructions**: If plugins are enabled in `rnex.yaml` (under `plugins:`), AI coding assistants MUST read instructions for each enabled plugin from its separate instruction files (located in `.rnex/instructions/` or `.rnex/rules/`).
|
|
664
|
+
7. **Git Operations**: Commit and push changes directly within the respective member repository root.
|
|
682
665
|
AGENTS_EOF
|
|
683
|
-
|
|
684
|
-
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
merge_rnex_instructions() {
|
|
669
|
+
_dst="$1"
|
|
670
|
+
_body_tmp="$(mktemp)"
|
|
671
|
+
get_rnex_instructions > "$_body_tmp"
|
|
672
|
+
|
|
673
|
+
if [ ! -f "$_dst" ]; then
|
|
674
|
+
mkdir -p "$(dirname "$_dst")"
|
|
675
|
+
printf '%s\n' "$AI_MARKER_START" > "$_dst"
|
|
676
|
+
cat "$_body_tmp" >> "$_dst"
|
|
677
|
+
printf '\n%s\n' "$AI_MARKER_END" >> "$_dst"
|
|
678
|
+
rm -f "$_body_tmp"
|
|
679
|
+
log_ok "Created $(basename "$_dst") with Repo Nexus instructions"
|
|
680
|
+
return 0
|
|
681
|
+
fi
|
|
682
|
+
|
|
683
|
+
# If delimiters already exist, update the block in-place
|
|
684
|
+
if grep -qF "$AI_MARKER_START" "$_dst" 2>/dev/null; then
|
|
685
|
+
_tmp="$(mktemp)"
|
|
686
|
+
awk -v s="$AI_MARKER_START" -v e="$AI_MARKER_END" -v src="$_body_tmp" '
|
|
687
|
+
$0 == s {
|
|
688
|
+
in_b = 1
|
|
689
|
+
print s
|
|
690
|
+
while ((getline line < src) > 0) print line
|
|
691
|
+
close(src)
|
|
692
|
+
next
|
|
693
|
+
}
|
|
694
|
+
$0 == e {
|
|
695
|
+
in_b = 0
|
|
696
|
+
print e
|
|
697
|
+
next
|
|
698
|
+
}
|
|
699
|
+
!in_b { print }
|
|
700
|
+
' "$_dst" > "$_tmp" && mv "$_tmp" "$_dst"
|
|
701
|
+
rm -f "$_body_tmp"
|
|
702
|
+
log_ok "Updated Repo Nexus instructions in $(basename "$_dst")"
|
|
703
|
+
return 0
|
|
704
|
+
fi
|
|
705
|
+
|
|
706
|
+
# If no delimiters, check if file already has up-to-date rnex instructions
|
|
707
|
+
if grep -q "rnex.yaml" "$_dst" 2>/dev/null && grep -qi "Plugin Instructions" "$_dst" 2>/dev/null; then
|
|
708
|
+
rm -f "$_body_tmp"
|
|
709
|
+
log_info "$(basename "$_dst") already contains Repo Nexus instructions"
|
|
710
|
+
return 0
|
|
711
|
+
fi
|
|
712
|
+
|
|
713
|
+
# Append rnex instructions block to existing instructions
|
|
714
|
+
_tmp="$(mktemp)"
|
|
715
|
+
cp "$_dst" "$_tmp"
|
|
716
|
+
if [ -s "$_tmp" ] && [ -n "$(tail -c 1 "$_tmp" 2>/dev/null)" ]; then
|
|
717
|
+
printf '\n' >> "$_tmp"
|
|
718
|
+
fi
|
|
719
|
+
{
|
|
720
|
+
printf '\n%s\n' "$AI_MARKER_START"
|
|
721
|
+
cat "$_body_tmp"
|
|
722
|
+
printf '\n%s\n' "$AI_MARKER_END"
|
|
723
|
+
} >> "$_tmp"
|
|
724
|
+
mv "$_tmp" "$_dst"
|
|
725
|
+
rm -f "$_body_tmp"
|
|
726
|
+
log_ok "Merged Repo Nexus instructions with existing $(basename "$_dst")"
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
# ============================================================================
|
|
730
|
+
# Commands
|
|
731
|
+
# ============================================================================
|
|
732
|
+
|
|
733
|
+
cmd_init() {
|
|
734
|
+
if [ -n "$CUSTOM_CONFIG" ]; then
|
|
735
|
+
_target_yaml="$(resolve_path "$CUSTOM_CONFIG")"
|
|
736
|
+
_target_dir="$(dirname "$_target_yaml")"
|
|
685
737
|
else
|
|
686
|
-
|
|
738
|
+
_target_dir="${1:-$PWD}"
|
|
739
|
+
_target_dir="$(resolve_path "$_target_dir")"
|
|
740
|
+
_target_yaml="$_target_dir/$RNEX_CONFIG_FILE"
|
|
687
741
|
fi
|
|
742
|
+
mkdir -p "$_target_dir"
|
|
688
743
|
|
|
689
|
-
# ----
|
|
690
|
-
|
|
744
|
+
# ---- 1. Create config file if no one is existing for specified or current dir ----
|
|
745
|
+
_config_created=0
|
|
746
|
+
if [ -f "$_target_yaml" ]; then
|
|
747
|
+
log_warn "Workspace configuration already exists at $_target_dir ($RNEX_CONFIG_FILE exists)"
|
|
748
|
+
log_dim "To reconcile symlinks and plugins, run:"
|
|
749
|
+
log_dim " rnex sync"
|
|
750
|
+
else
|
|
751
|
+
cat > "$_target_yaml" <<YAML_EOF
|
|
691
752
|
# Repo Nexus workspace configuration
|
|
692
753
|
# See docs/rnex.example.yaml for a comprehensive example with all options.
|
|
693
754
|
|
|
@@ -700,6 +761,26 @@ plugins:
|
|
|
700
761
|
# Member repositories managed by Repo Nexus
|
|
701
762
|
repos:
|
|
702
763
|
YAML_EOF
|
|
764
|
+
_config_created=1
|
|
765
|
+
log_ok "Created $RNEX_CONFIG_FILE"
|
|
766
|
+
fi
|
|
767
|
+
|
|
768
|
+
# ---- 2. Merge rnex instructions with existing instructions if they exist --------
|
|
769
|
+
_target_agents="$_target_dir/AGENTS.md"
|
|
770
|
+
_existing_inst_found=0
|
|
771
|
+
|
|
772
|
+
for _cand in "AGENTS.md" "CLAUDE.md" ".cursorrules" ".github/copilot-instructions.md" "GEMINI.md" ".windsurfrules"; do
|
|
773
|
+
_c_path="$_target_dir/$_cand"
|
|
774
|
+
if [ -f "$_c_path" ]; then
|
|
775
|
+
_existing_inst_found=1
|
|
776
|
+
merge_rnex_instructions "$_c_path"
|
|
777
|
+
fi
|
|
778
|
+
done
|
|
779
|
+
|
|
780
|
+
# If AGENTS.md was not among existing files, ensure AGENTS.md is created
|
|
781
|
+
if [ ! -f "$_target_agents" ]; then
|
|
782
|
+
merge_rnex_instructions "$_target_agents"
|
|
783
|
+
fi
|
|
703
784
|
|
|
704
785
|
# ---- Create repos directory -----------------------------------------------
|
|
705
786
|
_repos_dir="$_target_dir/repos"
|
|
@@ -707,14 +788,18 @@ YAML_EOF
|
|
|
707
788
|
|
|
708
789
|
# ---- Create internal .rnex directory --------------------------------------
|
|
709
790
|
mkdir -p "$_target_dir/.rnex"
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
791
|
+
mkdir -p "$_target_dir/.rnex/rules"
|
|
792
|
+
mkdir -p "$_target_dir/.rnex/instructions"
|
|
793
|
+
|
|
794
|
+
if [ "$_config_created" -eq 1 ]; then
|
|
795
|
+
printf '\n'
|
|
796
|
+
log_ok "Initialized Repo Nexus workspace at ${_BOLD}$_target_dir${_NC}"
|
|
797
|
+
log_dim "Created $RNEX_CONFIG_FILE, AGENTS.md, .rnex/, and repos/"
|
|
798
|
+
printf '\n'
|
|
799
|
+
log_info "Next steps:"
|
|
800
|
+
log_dim "1. Add repositories with: rnex add <name> <path>"
|
|
801
|
+
log_dim "2. See docs/rnex.example.yaml for a full configuration reference"
|
|
802
|
+
fi
|
|
718
803
|
}
|
|
719
804
|
|
|
720
805
|
cmd_add() {
|
|
@@ -1101,7 +1186,13 @@ cmd_plugin_disable() {
|
|
|
1101
1186
|
if [ -L "$_rpath/.rnex/$_rel_sub" ]; then
|
|
1102
1187
|
rm -f "$_rpath/.rnex/$_rel_sub"
|
|
1103
1188
|
fi
|
|
1189
|
+
rmdir "$_rpath/.rnex/instructions" 2>/dev/null || true
|
|
1190
|
+
rmdir "$_rpath/.rnex/rules" 2>/dev/null || true
|
|
1191
|
+
rmdir "$_rpath/.rnex/workflows" 2>/dev/null || true
|
|
1104
1192
|
done
|
|
1193
|
+
rmdir "$NEXUS_DIR/.rnex/instructions" 2>/dev/null || true
|
|
1194
|
+
rmdir "$NEXUS_DIR/.rnex/rules" 2>/dev/null || true
|
|
1195
|
+
rmdir "$NEXUS_DIR/.rnex/workflows" 2>/dev/null || true
|
|
1105
1196
|
done
|
|
1106
1197
|
fi
|
|
1107
1198
|
|
|
@@ -42,15 +42,16 @@ Reference specification: [setup-karpathy-wiki.md](https://github.com/nu-nenoi/ai
|
|
|
42
42
|
When an AI agent or developer sets up the Karpathy LLM Wiki in a repository or workspace, consult the Step 0 configuration questions:
|
|
43
43
|
|
|
44
44
|
1. **[Q1] Which AI agent instruction file should the wiki rules be written to?**
|
|
45
|
-
- `
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
- In a **Repo Nexus workspace**: Instructions are maintained in separate instructions files (`.rnex/instructions/karpathy-llm.md` and `.rnex/rules/KARPATHY_RULES.md`). Agents read `rnex.yaml` to detect enabled plugins and read their dedicated instructions files automatically.
|
|
46
|
+
- In a **standalone setup** (outside Repo Nexus):
|
|
47
|
+
- `AGENTS.md` (universal, works across most harnesses)
|
|
48
|
+
- `CLAUDE.md` (Claude Code / Anthropic)
|
|
49
|
+
- `.cursor/rules/wiki.mdc` (Cursor)
|
|
50
|
+
- `.github/copilot-instructions.md` (GitHub Copilot)
|
|
51
|
+
- `GEMINI.md` (Google Gemini / Antigravity)
|
|
52
|
+
- `.windsurfrules` (Windsurf)
|
|
53
|
+
- Other — specify path
|
|
54
|
+
*Append the `## Karpathy Wiki Rules` section to that file while preserving all existing content.*
|
|
54
55
|
|
|
55
56
|
2. **[Q2] What is this wiki for?**
|
|
56
57
|
- Research / reading list — articles, papers, PDFs on a topic
|
|
@@ -87,6 +88,8 @@ my-workspace/
|
|
|
87
88
|
│ ├── hot.md # Rolling ~500-word quick-orient context
|
|
88
89
|
│ └── _log.md # Ingestion & lint audit history
|
|
89
90
|
├── .rnex/
|
|
91
|
+
│ ├── instructions/
|
|
92
|
+
│ │ └── karpathy-llm.md # Dedicated plugin instructions (auto-symlinked)
|
|
90
93
|
│ ├── rules/
|
|
91
94
|
│ │ └── KARPATHY_RULES.md # Cardinal principles & wiki rules (auto-symlinked)
|
|
92
95
|
│ ├── workflows/
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Karpathy LLM Agent Guidelines & Behavioral Principles
|
|
2
|
+
|
|
3
|
+
> "The delicate art and science of context engineering: filling the context window with just the right information for the next step." — Andrej Karpathy
|
|
4
|
+
|
|
5
|
+
These guidelines provide standing operational instructions for AI coding assistants (Cursor, Claude Code, GitHub Copilot, Antigravity, Windsurf) working within multi-repository environments and managing Karpathy LLM Wiki knowledge bases.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. The Four Cardinal Principles
|
|
10
|
+
|
|
11
|
+
### Principle 1: Think Before Coding
|
|
12
|
+
* **State Assumptions Explicitly:** Before implementing any non-trivial change, state your understanding of the problem, assumptions made, and proposed solution.
|
|
13
|
+
* **Surface Trade-Offs:** If multiple approaches exist, outline the alternatives with their trade-offs before generating code.
|
|
14
|
+
* **Verify Repository Boundaries:** In multi-repo workspaces, determine which member repositories are affected. Never make silent architectural assumptions that span across repo boundaries.
|
|
15
|
+
|
|
16
|
+
### Principle 2: Simplicity First
|
|
17
|
+
* **Favor Readable Over Clever:** Write the simplest code that solves the immediate problem. Avoid unnecessary abstractions, speculative generics, and premature optimizations.
|
|
18
|
+
* **Zero Boilerplate Bloat:** Do not introduce extra wrapper layers, helper classes, or framework-heavy patterns unless explicitly requested or required by existing codebase conventions.
|
|
19
|
+
* **Less Code is Better Code:** If an existing utility, POSIX primitive, or library function does the job, reuse it.
|
|
20
|
+
|
|
21
|
+
### Principle 3: Surgical Changes
|
|
22
|
+
* **Minimal Blast Radius:** Touch *only* the lines and files required to achieve the goal.
|
|
23
|
+
* **Preserve Documentation & Comments:** Never delete or overwrite existing comments, documentation, or code structure unrelated to your changes.
|
|
24
|
+
* **Zero Unintended Reformatting:** Avoid running blanket code formatters across entire files that create massive, unreadable git diffs. Keep diffs tight, focused, and reviewable.
|
|
25
|
+
|
|
26
|
+
### Principle 4: Goal-Driven Execution & Verification
|
|
27
|
+
* **Define Success Criteria Upfront:** Know how you will prove that your change works before you write the first line of code.
|
|
28
|
+
* **Verify with Automated Checks:** Run linters, unit tests, and build commands before declaring a task complete.
|
|
29
|
+
* **Inspect the Diff:** Review your own git diff before committing or presenting the solution to ensure no extraneous changes were introduced.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 2. Multi-Repo Context Engineering
|
|
34
|
+
|
|
35
|
+
In a Repo Nexus workspace, independent repositories are unified into a single active scope via Unix symlinks. Coding agents must follow these rules:
|
|
36
|
+
|
|
37
|
+
1. **Symlink Write-Through:**
|
|
38
|
+
- Edits made to `repos/<name>/` write directly through to the underlying member repository on disk.
|
|
39
|
+
- Do not attempt to move or replace symlinks with regular directories.
|
|
40
|
+
|
|
41
|
+
2. **Repository Autonomy & Member .rnex Directory:**
|
|
42
|
+
- Member repositories are independent projects. Do not introduce cross-repository source imports or shared runtime dependencies unless an explicit monorepo architecture is configured.
|
|
43
|
+
- Member repositories may contain an `.rnex/` directory (e.g. `repos/<name>/.rnex/`) containing repository-specific documents, instructions, rules, workflows, and scripts. Coding assistants must inspect this directory for member-specific instructions.
|
|
44
|
+
- Run git operations (commits, branches, pushes) within the respective member repository root.
|
|
45
|
+
|
|
46
|
+
3. **Context Economy:**
|
|
47
|
+
- Do not redundantly read entire files or directory trees when targeted symbol lookups or line ranges suffice.
|
|
48
|
+
- Rely on active workspace context, indexing, and compiled documentation rather than re-scanning raw files repeatedly.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## 3. Karpathy Wiki Rules
|
|
53
|
+
|
|
54
|
+
When working in a repository with an active Karpathy LLM Wiki (`/wiki/` and `/raw/` directories):
|
|
55
|
+
|
|
56
|
+
- **Intake**: All source material (articles, transcripts, docs, notes) goes to `/raw/` unmodified. Never write directly to `/wiki/` without ingesting.
|
|
57
|
+
- **Orientation**: Before answering domain questions, read `/wiki/index.md` to find relevant pages, then read only those pages. If `hot.md` exists, read it first as a quick-orient step.
|
|
58
|
+
- **Ingestion**: When files appear in `/raw/`, run the `wiki-ingest` workflow (`.rnex/workflows/wiki-ingest.md`). One source document typically produces many atomic pages (commonly 5–25 pages) — do not collapse a source into a single file.
|
|
59
|
+
- **Cadence**: After any session where repository files were created, edited, or deleted, run `.rnex/scripts/wiki-lint-trigger.sh`. If it outputs `[WIKI MAINTENANCE DUE]`, run the `wiki-lint` workflow (`.rnex/workflows/wiki-lint.md`) before stopping.
|
|
60
|
+
- **No-op sessions**: Do not run the trigger after read-only or purely conversational sessions where no files changed.
|
|
61
|
+
- **Enable/disable**: Wiki automation is controlled by `lint_trigger_enabled: true|false` in `rnex.yaml` (and `lint_trigger: enabled|disabled` in `/wiki/index.md` frontmatter). Edit either field to toggle.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## 4. Typed Frontmatter Relation Schema
|
|
66
|
+
|
|
67
|
+
Every page in `/wiki/` must maintain typed frontmatter relations:
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
---
|
|
71
|
+
title: ""
|
|
72
|
+
tags: []
|
|
73
|
+
last_updated: YYYY-MM-DD
|
|
74
|
+
# Typed relation fields — paths relative to /wiki/
|
|
75
|
+
sources: [] # /raw/ files this page was derived from
|
|
76
|
+
related: [] # thematically related wiki pages
|
|
77
|
+
extends: [] # pages this one builds upon or specialises
|
|
78
|
+
contradicts: [] # pages with conflicting information
|
|
79
|
+
mentioned_in: [] # pages that link to this one (maintained by lint)
|
|
80
|
+
---
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Body:** concise summary, key facts or insights, and inline standard Markdown links (`[Label](./path.md)`) where contextually useful in prose.
|
|
84
|
+
|
|
85
|
+
The relation graph lives in frontmatter, not in prose links. Agents traverse the graph by reading frontmatter fields, not by scanning body text.
|
|
@@ -7,6 +7,8 @@ rules:
|
|
|
7
7
|
- rules/KARPATHY_RULES.md: .rnex/rules/KARPATHY_RULES.md
|
|
8
8
|
- workflows/wiki-ingest.md: .rnex/workflows/wiki-ingest.md
|
|
9
9
|
- workflows/wiki-lint.md: .rnex/workflows/wiki-lint.md
|
|
10
|
+
instructions:
|
|
11
|
+
- instructions/karpathy-llm.md: .rnex/instructions/karpathy-llm.md
|
|
10
12
|
templates:
|
|
11
13
|
- templates/index.md: wiki/index.md
|
|
12
14
|
- templates/_log.md: wiki/_log.md
|
|
@@ -17,15 +17,16 @@ Do not hard-code any specific AI tool or harness into the wiki structure itself.
|
|
|
17
17
|
Ask ALL of the following questions and wait for answers:
|
|
18
18
|
|
|
19
19
|
[Q1] Which AI agent instruction file should the wiki rules be written to?
|
|
20
|
-
- `
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
20
|
+
- In a Repo Nexus workspace: plugin instructions are maintained in separate instructions files (`.rnex/instructions/karpathy-llm.md` and `.rnex/rules/KARPATHY_RULES.md`). Agents read `rnex.yaml` to detect enabled plugins and read their separate instructions files.
|
|
21
|
+
- In a standalone setup (outside Repo Nexus):
|
|
22
|
+
- `AGENTS.md` (universal, works across most harnesses)
|
|
23
|
+
- `CLAUDE.md` (Claude Code / Anthropic)
|
|
24
|
+
- `.cursor/rules/wiki.mdc` (Cursor)
|
|
25
|
+
- `.github/copilot-instructions.md` (GitHub Copilot)
|
|
26
|
+
- `GEMINI.md` (Google Gemini / Antigravity)
|
|
27
|
+
- `.windsurfrules` (Windsurf)
|
|
28
|
+
- Other — specify path
|
|
29
|
+
Append a `## Karpathy Wiki Rules` section to that file. Preserve all existing content.
|
|
29
30
|
|
|
30
31
|
[Q2] What is this wiki for?
|
|
31
32
|
- Research / reading list — articles, papers, PDFs on a topic
|