repo-nexus 0.4.0 → 0.4.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 CHANGED
@@ -213,7 +213,7 @@ rnex plugin disable karpathy-llm
213
213
 
214
214
  ### Built-in Plugin: `karpathy-llm`
215
215
  The `karpathy-llm` plugin packages Andrej Karpathy's verified LLM agent design patterns, context engineering principles, and the autonomous **Karpathy LLM Wiki** architecture:
216
- * **The 4 Cardinal Agent Rules** (`.rnex/plugins/karpathy-llm/rules/KARPATHY_RULES.md`):
216
+ * **The 4 Cardinal Agent Rules** (`.rnex/plugins/karpathy-llm/rules/behavioral.md`):
217
217
  1. *Think Before Coding:* Formulate explicit assumptions, boundary checks, and trade-offs before writing code.
218
218
  2. *Simplicity First:* Minimal abstractions, readable implementations, zero speculative boilerplate.
219
219
  3. *Surgical Changes:* Minimal blast radius, preserved comments/docstrings, and tight diffs.
@@ -277,7 +277,7 @@ repos:
277
277
  |:---|:---|
278
278
  | `-c, --config <file>` | Explicit path to `rnex.yaml` (executes in that workspace directory) |
279
279
  | `-h, --help` | Display command help and usage instructions |
280
- | `-v, --version` | Display version (v0.4.0) |
280
+ | `-v, --version` | Display version |
281
281
 
282
282
  ### Commands
283
283
  | Command | Description |
@@ -327,7 +327,7 @@ rnex completion fish | source
327
327
 
328
328
  ```
329
329
  repo-nexus/
330
- ├── package.json # npm package manifest (single source of truth for v0.4.0)
330
+ ├── package.json # npm package manifest (single version source of truth)
331
331
  ├── rnex # CLI executable (POSIX shell)
332
332
  ├── AGENTS.md # Routing-only universal AI instructions
333
333
  ├── docs/
@@ -3,14 +3,15 @@
3
3
 
4
4
  This workspace operates as a **Repo Nexus Virtual Meta-Repo** uniting independent repositories.
5
5
 
6
- ## Rules for AI Coding Assistants
6
+ ## Routing Protocol for AI Assistants
7
7
 
8
- 1. **Read Configuration First (Mandatory)**: AI coding assistants MUST inspect and read `.local.rnex.yaml` (if present) and `rnex.yaml` before planning or executing tasks to understand the workspace structure (`repos_dir`), registered member repositories, and active plugins.
9
- - **Highest Priority**: `.local.rnex.yaml` takes highest priority over `rnex.yaml`.
10
- - **Default State**: Repositories are enabled by default unless explicitly set to `enabled: false`. Disabled repositories must be excluded from active tasks.
11
- 2. **Repository Boundaries**: Member repositories reside under `repos/<name>/` as independent Git repositories. Edits directly modify files in the respective repository. Do not introduce cross-repo imports unless architected.
12
- 3. **Plugin Instructions & Rules Routing**: Detailed guidelines and workflows for enabled plugins are strictly scoped. AI assistants MUST read instructions for each enabled plugin from its separate directory under:
8
+ AI assistants working in this workspace must route context through the following configuration and instructions files:
9
+
10
+ 1. **Read Configuration First (Highest Priority)**: Inspect and read `.local.rnex.yaml` (if present) and `rnex.yaml` before executing tasks to identify workspace structure (`repos_dir`), active member repositories (`repos/`), and enabled plugins.
11
+ - `.local.rnex.yaml` takes highest priority over `rnex.yaml`.
12
+ - Repositories are enabled by default unless explicitly marked `enabled: false`. Disabled repositories are excluded from active tasks.
13
+ 2. **Member Repositories (`repos/<name>/`)**: Each member repository is an autonomous Git repository. For repository-specific instructions, inspect `repos/<name>/.rnex/`.
14
+ 3. **Plugin Instructions & Rules Routing**: Detailed guidelines and workflows for enabled plugins are located under:
13
15
  `.rnex/plugins/<plugin-name>/`
14
- 4. **Member Repo RNEX Context Routing**: AI assistants operating at the workspace level MUST inspect `repos/<name>/.rnex/` for member-specific instructions, guidelines, and commands.
15
- 5. **Git Operations**: Commit and push changes directly within the respective member repository root (`repos/<name>/`).
16
+ 4. **Git Operations**: Commit and push changes directly within the respective member repository root (`repos/<name>/`).
16
17
  <!-- REPO-NEXUS:END -->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repo-nexus",
3
- "version": "0.4.0",
3
+ "version": "0.4.3",
4
4
  "description": "Lightweight, zero-dependency Virtual Meta-Repo companion for multi-repo workspaces and shared AI context (no git submodules)",
5
5
  "bin": {
6
6
  "repo-nexus": "rnex",
package/rnex CHANGED
@@ -85,7 +85,7 @@ resolve_version() {
85
85
  fi
86
86
  fi
87
87
  done
88
- printf '0.4.0'
88
+ printf '0.4.1'
89
89
  }
90
90
 
91
91
  RNEX_VERSION="$(resolve_version)"
@@ -728,6 +728,58 @@ sync_plugins() {
728
728
 
729
729
  # ---- AI Instructions Management (Routing-Only) ----------------------------
730
730
 
731
+ reconcile_gitignore() {
732
+ _dir="${1:-$NEXUS_DIR}"
733
+ _gi="$_dir/.gitignore"
734
+
735
+ if [ ! -f "$_gi" ]; then
736
+ cat > "$_gi" <<GI_EOF
737
+ # Member repos (managed by rnex, ignored at workspace level)
738
+ repos/*
739
+ !repos/.gitkeep
740
+
741
+ # Repo Nexus internal state & cache
742
+ .rnex/
743
+
744
+ # Local machine-specific configuration
745
+ $RNEX_LOCAL_CONFIG_FILE
746
+ .rnex.local.yaml
747
+ GI_EOF
748
+ log_ok "Created .gitignore (ignoring repos/, .rnex/, and $RNEX_LOCAL_CONFIG_FILE)"
749
+ return 0
750
+ fi
751
+
752
+ # 1. Strip any legacy lint_trigger_counter entries if present
753
+ if grep -q "lint_trigger_counter" "$_gi" 2>/dev/null; then
754
+ _tmp="$(mktemp)"
755
+ grep -v "lint_trigger_counter" "$_gi" > "$_tmp" && mv "$_tmp" "$_gi"
756
+ log_ok "Removed legacy lint trigger counter entries from .gitignore"
757
+ fi
758
+
759
+ # 2. Ensure repos/* is ignored
760
+ if ! grep -q "^repos" "$_gi" 2>/dev/null; then
761
+ printf '\n# Member repos (managed by rnex)\nrepos/*\n!repos/.gitkeep\n' >> "$_gi"
762
+ log_dim "Added repos/* to .gitignore"
763
+ fi
764
+
765
+ # 3. Ensure .rnex/ is ignored
766
+ if ! grep -q '^\.rnex/' "$_gi" 2>/dev/null && ! grep -q '^\.rnex$' "$_gi" 2>/dev/null; then
767
+ printf '\n# Repo Nexus internal state & cache\n.rnex/\n' >> "$_gi"
768
+ log_dim "Added .rnex/ to .gitignore"
769
+ fi
770
+
771
+ # 4. Ensure local config files are ignored
772
+ if ! grep -qF "$RNEX_LOCAL_CONFIG_FILE" "$_gi" 2>/dev/null; then
773
+ printf '\n# Local machine-specific configuration\n%s\n' "$RNEX_LOCAL_CONFIG_FILE" >> "$_gi"
774
+ log_dim "Added $RNEX_LOCAL_CONFIG_FILE to .gitignore"
775
+ fi
776
+ if ! grep -qF ".rnex.local.yaml" "$_gi" 2>/dev/null; then
777
+ printf '.rnex.local.yaml\n' >> "$_gi"
778
+ fi
779
+ }
780
+
781
+ # ---- AI Instructions Management (Routing-Only) ----------------------------
782
+
731
783
  AI_MARKER_START="<!-- REPO-NEXUS:START -->"
732
784
  AI_MARKER_END="<!-- REPO-NEXUS:END -->"
733
785
 
@@ -737,16 +789,17 @@ get_rnex_instructions() {
737
789
 
738
790
  This workspace operates as a **Repo Nexus Virtual Meta-Repo** uniting independent repositories.
739
791
 
740
- ## Rules for AI Coding Assistants
792
+ ## Routing Protocol for AI Assistants
793
+
794
+ AI assistants working in this workspace must route context through the following configuration and instructions files:
741
795
 
742
- 1. **Read Configuration First (Mandatory)**: AI coding assistants MUST inspect and read `.local.rnex.yaml` (if present) and `rnex.yaml` before planning or executing tasks to understand the workspace structure (`repos_dir`), registered member repositories, and active plugins.
743
- - **Highest Priority**: `.local.rnex.yaml` takes highest priority over `rnex.yaml`.
744
- - **Default State**: Repositories are enabled by default unless explicitly set to `enabled: false`. Disabled repositories must be excluded from active tasks.
745
- 2. **Repository Boundaries**: Member repositories reside under `repos/<name>/` as independent Git repositories. Edits directly modify files in the respective repository. Do not introduce cross-repo imports unless architected.
746
- 3. **Plugin Instructions & Rules Routing**: Detailed guidelines and workflows for enabled plugins are strictly scoped. AI assistants MUST read instructions for each enabled plugin from its separate directory under:
796
+ 1. **Read Configuration First (Highest Priority)**: Inspect and read `.local.rnex.yaml` (if present) and `rnex.yaml` before executing tasks to identify workspace structure (`repos_dir`), active member repositories (`repos/`), and enabled plugins.
797
+ - `.local.rnex.yaml` takes highest priority over `rnex.yaml`.
798
+ - Repositories are enabled by default unless explicitly marked `enabled: false`. Disabled repositories are excluded from active tasks.
799
+ 2. **Member Repositories (`repos/<name>/`)**: Each member repository is an autonomous Git repository. For repository-specific instructions, inspect `repos/<name>/.rnex/`.
800
+ 3. **Plugin Instructions & Rules Routing**: Detailed guidelines and workflows for enabled plugins are located under:
747
801
  `.rnex/plugins/<plugin-name>/`
748
- 4. **Member Repo RNEX Context Routing**: AI assistants operating at the workspace level MUST inspect `repos/<name>/.rnex/` for member-specific instructions, guidelines, and commands.
749
- 5. **Git Operations**: Commit and push changes directly within the respective member repository root (`repos/<name>/`).
802
+ 4. **Git Operations**: Commit and push changes directly within the respective member repository root (`repos/<name>/`).
750
803
  AGENTS_EOF
751
804
  }
752
805
 
@@ -757,15 +810,17 @@ merge_rnex_instructions() {
757
810
 
758
811
  if [ ! -f "$_dst" ]; then
759
812
  mkdir -p "$(dirname "$_dst")"
760
- printf '%s\n' "$AI_MARKER_START" > "$_dst"
761
- cat "$_body_tmp" >> "$_dst"
762
- printf '\n%s\n' "$AI_MARKER_END" >> "$_dst"
813
+ {
814
+ printf '%s\n' "$AI_MARKER_START"
815
+ cat "$_body_tmp"
816
+ printf '\n%s\n' "$AI_MARKER_END"
817
+ } > "$_dst"
763
818
  rm -f "$_body_tmp"
764
819
  log_ok "Created $(basename "$_dst") with Repo Nexus routing instructions"
765
820
  return 0
766
821
  fi
767
822
 
768
- # If delimiters already exist, update the block in-place
823
+ # Case 1: If delimiters already exist, update the block in-place
769
824
  if grep -qF "$AI_MARKER_START" "$_dst" 2>/dev/null; then
770
825
  _tmp="$(mktemp)"
771
826
  awk -v s="$AI_MARKER_START" -v e="$AI_MARKER_END" -v src="$_body_tmp" '
@@ -784,18 +839,51 @@ merge_rnex_instructions() {
784
839
  !in_b { print }
785
840
  ' "$_dst" > "$_tmp" && mv "$_tmp" "$_dst"
786
841
  rm -f "$_body_tmp"
787
- log_ok "Updated Repo Nexus instructions in $(basename "$_dst")"
842
+ log_ok "Updated Repo Nexus routing instructions in $(basename "$_dst")"
788
843
  return 0
789
844
  fi
790
845
 
791
- # If no delimiters, check if file already has up-to-date rnex instructions
792
- if grep -q "rnex.yaml" "$_dst" 2>/dev/null && grep -qi "Plugin Instructions" "$_dst" 2>/dev/null; then
846
+ # Case 2: If no delimiters, check for legacy un-delimited Repo Nexus block
847
+ # (e.g. starting with "# Multi-Repo AI Workspace Context" or containing "Symlink Write-Through")
848
+ if grep -q "Multi-Repo AI Workspace Context" "$_dst" 2>/dev/null || grep -q "Symlink Write-Through" "$_dst" 2>/dev/null; then
849
+ _tmp="$(mktemp)"
850
+ awk -v s="$AI_MARKER_START" -v e="$AI_MARKER_END" -v src="$_body_tmp" '
851
+ BEGIN { in_legacy = 0; replaced = 0 }
852
+ /^# Multi-Repo AI Workspace Context/ {
853
+ in_legacy = 1
854
+ if (!replaced) {
855
+ print s
856
+ while ((getline line < src) > 0) print line
857
+ close(src)
858
+ print e
859
+ replaced = 1
860
+ }
861
+ next
862
+ }
863
+ in_legacy {
864
+ if (/^# [^#]/ && !/^# Multi-Repo/) {
865
+ in_legacy = 0
866
+ print
867
+ next
868
+ }
869
+ next
870
+ }
871
+ !in_legacy { print }
872
+ END {
873
+ if (!replaced) {
874
+ print s
875
+ while ((getline line < src) > 0) print line
876
+ close(src)
877
+ print e
878
+ }
879
+ }
880
+ ' "$_dst" > "$_tmp" && mv "$_tmp" "$_dst"
793
881
  rm -f "$_body_tmp"
794
- log_info "$(basename "$_dst") already contains Repo Nexus instructions"
882
+ log_ok "Upgraded legacy instructions to Repo Nexus routing block in $(basename "$_dst")"
795
883
  return 0
796
884
  fi
797
885
 
798
- # Append rnex instructions block to existing instructions
886
+ # Case 3: Completely custom instructions file without rnex context — append delimited block
799
887
  _tmp="$(mktemp)"
800
888
  cp "$_dst" "$_tmp"
801
889
  if [ -s "$_tmp" ] && [ -n "$(tail -c 1 "$_tmp" 2>/dev/null)" ]; then
@@ -808,7 +896,7 @@ merge_rnex_instructions() {
808
896
  } >> "$_tmp"
809
897
  mv "$_tmp" "$_dst"
810
898
  rm -f "$_body_tmp"
811
- log_ok "Merged Repo Nexus instructions with existing $(basename "$_dst")"
899
+ log_ok "Merged Repo Nexus routing instructions with existing $(basename "$_dst")"
812
900
  }
813
901
 
814
902
  # ============================================================================
@@ -903,29 +991,8 @@ YAML_EOF
903
991
  mkdir -p "$_target_dir/.rnex"
904
992
  mkdir -p "$_target_dir/.rnex/plugins"
905
993
 
906
- # ---- 6. Ensure repos/ and local configs are gitignored -------------------
907
- _target_gi="$_target_dir/.gitignore"
908
- if [ ! -f "$_target_gi" ]; then
909
- cat > "$_target_gi" <<GI_EOF
910
- # Member repos (managed by rnex, ignored at workspace level)
911
- repos/*
912
- !repos/.gitkeep
913
-
914
- # Local machine-specific configuration
915
- $RNEX_LOCAL_CONFIG_FILE
916
- .rnex.local.yaml
917
- GI_EOF
918
- log_ok "Created .gitignore (ignoring repos/ and $RNEX_LOCAL_CONFIG_FILE)"
919
- else
920
- if ! grep -q "^repos" "$_target_gi" 2>/dev/null; then
921
- printf '\n# Member repos (managed by rnex)\nrepos/*\n!repos/.gitkeep\n' >> "$_target_gi"
922
- log_dim "Added repos/* to .gitignore"
923
- fi
924
- if ! grep -qF "$RNEX_LOCAL_CONFIG_FILE" "$_target_gi" 2>/dev/null; then
925
- printf '\n# Local machine-specific configuration\n%s\n.rnex.local.yaml\n' "$RNEX_LOCAL_CONFIG_FILE" >> "$_target_gi"
926
- log_dim "Added $RNEX_LOCAL_CONFIG_FILE to .gitignore"
927
- fi
928
- fi
994
+ # ---- 6. Ensure repos/, .rnex/, and local configs are gitignored ---------
995
+ reconcile_gitignore "$_target_dir"
929
996
 
930
997
  if [ "$_config_created" -eq 1 ]; then
931
998
  printf '\n'
@@ -1217,10 +1284,18 @@ cmd_status() {
1217
1284
  printf ' %b●%b Repos Dir: %s\n' "$_DIM" "$_NC" "$REPOS_DIR"
1218
1285
 
1219
1286
  _gi="$NEXUS_DIR/.gitignore"
1220
- if [ -f "$_gi" ] && grep -q '^repos' "$_gi" 2>/dev/null && grep -qF "$RNEX_LOCAL_CONFIG_FILE" "$_gi" 2>/dev/null; then
1221
- printf ' %b✓%b Git Ignore: repos/ and %s ignored in .gitignore\n' "$_G" "$_NC" "$RNEX_LOCAL_CONFIG_FILE"
1287
+ _gi_repos=0; _gi_rnex=0; _gi_local=0; _gi_has_counter=0
1288
+ if [ -f "$_gi" ]; then
1289
+ grep -q '^repos' "$_gi" 2>/dev/null && _gi_repos=1
1290
+ (grep -q '^\.rnex/' "$_gi" 2>/dev/null || grep -q '^\.rnex$' "$_gi" 2>/dev/null) && _gi_rnex=1
1291
+ grep -qF "$RNEX_LOCAL_CONFIG_FILE" "$_gi" 2>/dev/null && _gi_local=1
1292
+ grep -q "lint_trigger_counter" "$_gi" 2>/dev/null && _gi_has_counter=1
1293
+ fi
1294
+
1295
+ if [ "$_gi_repos" -eq 1 ] && [ "$_gi_rnex" -eq 1 ] && [ "$_gi_local" -eq 1 ] && [ "$_gi_has_counter" -eq 0 ]; then
1296
+ printf ' %b✓%b Git Ignore: repos/, .rnex/, and %s ignored in .gitignore\n' "$_G" "$_NC" "$RNEX_LOCAL_CONFIG_FILE"
1222
1297
  else
1223
- printf ' %b!%b Git Ignore: recommend running "rnex fix" to ignore repos/ and local configs\n' "$_Y" "$_NC"
1298
+ printf ' %b!%b Git Ignore: recommend running "rnex fix" to update .gitignore (repos/, .rnex/, local configs)\n' "$_Y" "$_NC"
1224
1299
  fi
1225
1300
  printf '\n'
1226
1301
 
@@ -1302,32 +1377,13 @@ cmd_fix() {
1302
1377
 
1303
1378
  log_info "Reconciling Repo Nexus workspace at $NEXUS_DIR..."
1304
1379
 
1305
- # 1. Ensure .gitignore ignores repos/ and .local.rnex.yaml
1306
- _gi="$NEXUS_DIR/.gitignore"
1307
- if [ ! -f "$_gi" ]; then
1308
- cat > "$_gi" <<GI_EOF
1309
- # Member repos (managed by rnex)
1310
- repos/*
1311
- !repos/.gitkeep
1312
-
1313
- # Local machine-specific configuration
1314
- $RNEX_LOCAL_CONFIG_FILE
1315
- .rnex.local.yaml
1316
- GI_EOF
1317
- log_ok "Created .gitignore"
1318
- else
1319
- if ! grep -q "^repos" "$_gi" 2>/dev/null; then
1320
- printf '\n# Member repos (managed by rnex)\nrepos/*\n!repos/.gitkeep\n' >> "$_gi"
1321
- log_ok "Added repos/* to .gitignore"
1322
- fi
1323
- if ! grep -qF "$RNEX_LOCAL_CONFIG_FILE" "$_gi" 2>/dev/null; then
1324
- printf '\n# Local machine-specific configuration\n%s\n.rnex.local.yaml\n' "$RNEX_LOCAL_CONFIG_FILE" >> "$_gi"
1325
- log_ok "Added $RNEX_LOCAL_CONFIG_FILE to .gitignore"
1326
- fi
1327
- fi
1380
+ # 1. Ensure .gitignore ignores repos/, .rnex/, and local configs, and strips legacy counters
1381
+ reconcile_gitignore "$NEXUS_DIR"
1328
1382
 
1329
- # 2. Reconcile instructions in AGENTS.md
1383
+ # 2. Reconcile instructions in AGENTS.md (and optional AI assistant files if present)
1330
1384
  merge_rnex_instructions "$NEXUS_DIR/AGENTS.md"
1385
+ [ -f "$NEXUS_DIR/CLAUDE.md" ] && merge_rnex_instructions "$NEXUS_DIR/CLAUDE.md"
1386
+ [ -f "$NEXUS_DIR/.cursorrules" ] && merge_rnex_instructions "$NEXUS_DIR/.cursorrules"
1331
1387
 
1332
1388
  # 3. Reconcile plugins
1333
1389
  sync_plugins
@@ -10,16 +10,16 @@ Reference specification: [setup-karpathy-wiki.md](https://github.com/nu-nenoi/ai
10
10
 
11
11
  ## What It Provides
12
12
 
13
- ### 1. The 4 Cardinal Principles for Coding Agents (`rules/KARPATHY_RULES.md`)
13
+ ### 1. The 4 Cardinal Principles for Coding Agents (`rules/behavioral.md`)
14
14
  * **Think Before Coding:** Explicit assumptions, problem formulation, and trade-off evaluation before writing code.
15
15
  * **Simplicity First:** Minimal abstractions, readable implementations, and zero boilerplate bloat.
16
16
  * **Surgical Changes:** Minimal blast radius, preserved comments/docstrings, and tightly focused diffs.
17
17
  * **Goal-Driven Execution:** Upfront verification criteria, automated tests, and rigorous diff review.
18
18
 
19
- ### 2. Multi-Repo Context Engineering & Autonomy
20
- * Guidelines tailored for Repo Nexus workspaces respecting member repository autonomy and symlink write-through semantics.
19
+ ### 2. Multi-Repo Context Engineering & Autonomy (`rules/behavioral.md`)
20
+ * Guidelines tailored for Repo Nexus workspaces respecting member repository autonomy and physical repository boundaries.
21
21
 
22
- ### 3. Complete Karpathy LLM Wiki Architecture
22
+ ### 3. Complete Karpathy LLM Wiki Architecture (`instructions/wiki-architecture.md`)
23
23
  * **`/raw/` Intake Directory:** Append-only directory where unmodified source material (articles, transcripts, docs, meeting notes) is deposited. Includes `.gitkeep`.
24
24
  * **`/wiki/` Curated Knowledge Base:** Interlinked atomic markdown pages, each with typed frontmatter relations (`sources`, `related`, `extends`, `contradicts`, `mentioned_in`).
25
25
  * **`/wiki/index.md` Navigation Index:** Master categorized catalog organizing atomic concepts, architecture decisions, and cross-project knowledge.
@@ -37,7 +37,7 @@ Reference specification: [setup-karpathy-wiki.md](https://github.com/nu-nenoi/ai
37
37
  When an AI agent or developer sets up the Karpathy LLM Wiki in a repository or workspace, consult the Step 0 configuration questions:
38
38
 
39
39
  1. **[Q1] Which AI agent instruction file should the wiki rules be written to?**
40
- - 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.
40
+ - In a **Repo Nexus workspace**: Instructions are scoped under `.rnex/plugins/karpathy-llm/` (`rules/behavioral.md` and `instructions/wiki-architecture.md`). Agents read `rnex.yaml` to detect enabled plugins and route context automatically.
41
41
  - In a **standalone setup** (outside Repo Nexus):
42
42
  - `AGENTS.md` (universal, works across most harnesses)
43
43
  - `CLAUDE.md` (Claude Code / Anthropic)
@@ -79,16 +79,18 @@ my-workspace/
79
79
  │ ├── hot.md # Rolling ~500-word quick-orient context
80
80
  │ └── _log.md # Ingestion & lint audit history
81
81
  ├── .rnex/
82
- │ ├── instructions/
83
- │ │ └── karpathy-llm.md # Dedicated plugin instructions (auto-symlinked)
84
- │ ├── rules/
85
- │ │ └── KARPATHY_RULES.md # Cardinal principles & wiki rules (auto-symlinked)
86
- │ ├── workflows/
87
- │ │ ├── wiki-ingest.md # 8-step decomposition & ingestion workflow
88
- │ │ └── wiki-lint.md # 10-step graph validation & maintenance workflow
89
- │ └── templates/
90
- │ ├── wiki-page.template.md # Atomic page template with typed relations
91
- │ └── LLM_WIKI.sample.md # Sample wiki walkthrough
82
+ │ └── plugins/
83
+ │ └── karpathy-llm/
84
+ │ ├── instructions/
85
+ │ │ └── wiki-architecture.md# LLM Wiki architecture & relation schema
86
+ │ ├── rules/
87
+ │ │ └── behavioral.md # Cardinal principles & context engineering
88
+ │ ├── workflows/
89
+ │ │ ├── wiki-ingest.md # 8-step decomposition & ingestion workflow
90
+ │ │ └── wiki-lint.md # 10-step graph validation & maintenance workflow
91
+ │ └── templates/
92
+ │ ├── wiki-page.template.md# Atomic page template with typed relations
93
+ │ └── LLM_WIKI.sample.md# Sample wiki walkthrough
92
94
  └── rnex.yaml # Plugin configuration
93
95
  ```
94
96
 
@@ -105,7 +107,7 @@ rnex plugin enable karpathy-llm
105
107
  This command:
106
108
  1. Adds `karpathy-llm` to `plugins:` in `rnex.yaml`.
107
109
  2. Copies initial templates (`wiki/index.md`, `wiki/_log.md`, `wiki/hot.md`, `raw/.gitkeep`, `.rnex/templates/wiki-page.template.md`, `.rnex/templates/LLM_WIKI.sample.md`).
108
- 3. Links `KARPATHY_RULES.md` and workflows into `.rnex/rules/` and `.rnex/workflows/`.
110
+ 3. Scopes `rules/`, `instructions/`, and `workflows/` into `.rnex/plugins/karpathy-llm/`.
109
111
  4. Syncs scope links and AI context files across all registered member repositories via `rnex fix`.
110
112
 
111
113
  ### Option 2: Declarative in `rnex.yaml`
@@ -0,0 +1,43 @@
1
+ # Karpathy LLM Wiki Knowledge Architecture
2
+
3
+ > "A persistent, compounding knowledge base optimized for AI agents." — Andrej Karpathy
4
+
5
+ This instruction document defines the operational rules, intake lifecycle, and typed relation schema for the Karpathy LLM Wiki (`/wiki/` and `/raw/` directories).
6
+
7
+ ---
8
+
9
+ ## 1. Operating Rules
10
+
11
+ When working in a workspace with an active Karpathy LLM Wiki:
12
+
13
+ - **Intake**: All source material (articles, transcripts, docs, notes) goes to `/raw/` unmodified. Never write directly to `/wiki/` without ingesting.
14
+ - **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.
15
+ - **Ingestion**: When files appear in `/raw/`, run the `wiki-ingest` workflow (`.rnex/plugins/karpathy-llm/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.
16
+ - **Maintenance**: Run the `wiki-lint` workflow (`.rnex/plugins/karpathy-llm/workflows/wiki-lint.md`) to validate paths, update `mentioned_in`, and preserve graph integrity.
17
+
18
+ ---
19
+
20
+ ## 2. Typed Frontmatter Relation Schema
21
+
22
+ Every page in `/wiki/` must maintain typed frontmatter relations:
23
+
24
+ ```yaml
25
+ ---
26
+ title: ""
27
+ tags: []
28
+ last_updated: YYYY-MM-DD
29
+ # Typed relation fields — paths relative to /wiki/
30
+ sources: [] # /raw/ files this page was derived from
31
+ related: [] # thematically related wiki pages
32
+ extends: [] # pages this one builds upon or specialises
33
+ contradicts: [] # pages with conflicting information
34
+ mentioned_in: [] # pages that link to this one (maintained by lint)
35
+ ---
36
+ ```
37
+
38
+ **Body Structure:**
39
+ - Concise summary of the concept.
40
+ - Key facts, definitions, or insights.
41
+ - Inline standard Markdown links (`[Label](./path.md)`) where contextually useful in prose.
42
+
43
+ The relation graph lives in frontmatter, not in prose links. Agents traverse the graph by reading frontmatter fields, not by scanning body text.
@@ -1,14 +1,14 @@
1
1
  name: karpathy-llm
2
- version: 0.4.0
2
+ version: 0.4.1
3
3
  description: Andrej Karpathy's agent behavioral principles, context engineering guidelines, and autonomous LLM Wiki knowledge architecture
4
4
  author: nu-nenoi
5
5
  homepage: https://github.com/nu-nenoi/repo-nexus
6
6
  rules:
7
- - rules/KARPATHY_RULES.md: .rnex/plugins/karpathy-llm/rules/KARPATHY_RULES.md
7
+ - rules/behavioral.md: .rnex/plugins/karpathy-llm/rules/behavioral.md
8
8
  - workflows/wiki-ingest.md: .rnex/plugins/karpathy-llm/workflows/wiki-ingest.md
9
9
  - workflows/wiki-lint.md: .rnex/plugins/karpathy-llm/workflows/wiki-lint.md
10
10
  instructions:
11
- - instructions/karpathy-llm.md: .rnex/plugins/karpathy-llm/instructions/karpathy-llm.md
11
+ - instructions/wiki-architecture.md: .rnex/plugins/karpathy-llm/instructions/wiki-architecture.md
12
12
  templates:
13
13
  - templates/index.md: wiki/index.md
14
14
  - templates/_log.md: wiki/_log.md
@@ -0,0 +1,47 @@
1
+ # Karpathy Coding Agent 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 rules define standing behavioral principles for AI coding assistants (Cursor, Claude Code, GitHub Copilot, Antigravity, Windsurf) working in this workspace.
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 organized into `./repos/<name>/` as autonomous Git repositories. Coding agents must follow these rules:
36
+
37
+ 1. **Repository Boundaries:**
38
+ - Edits made to `repos/<name>/` modify the underlying member repository directly.
39
+ - Member repositories are autonomous projects. Do not introduce cross-repository source imports or shared runtime dependencies unless an explicit monorepo architecture is configured.
40
+
41
+ 2. **Member .rnex Directory Routing:**
42
+ - 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.
43
+ - Run git operations (commits, branches, pushes) directly within the respective member repository root (`repos/<name>/`).
44
+
45
+ 3. **Context Economy:**
46
+ - Do not redundantly read entire files or directory trees when targeted symbol lookups or line ranges suffice.
47
+ - Rely on active workspace context, indexing, and compiled documentation rather than re-scanning raw files repeatedly.
@@ -8,7 +8,7 @@
8
8
 
9
9
  * **Workspace Name:** `my-multi-repo-workspace`
10
10
  * **Orchestrator:** Repo Nexus (`rnex`)
11
- * **Primary Scope:** Symlinked repositories under `./repos/`
11
+ * **Primary Scope:** Member repositories under `./repos/`
12
12
 
13
13
  ---
14
14
 
@@ -36,8 +36,8 @@
36
36
 
37
37
  ### ADR-001: Independent Git Repositories over Monorepo
38
38
  * **Date:** YYYY-MM-DD
39
- * **Decision:** Keep repositories completely independent without Git submodules. Orchestrate via Repo Nexus symlinks.
40
- * **Consequences:** Autonomous CI/CD per repo; AI assistants maintain shared context via `AGENTS.md` and `KARPATHY_RULES.md`.
39
+ * **Decision:** Keep repositories completely independent without Git submodules. Orchestrate via Repo Nexus Virtual Meta-Repo.
40
+ * **Consequences:** Autonomous CI/CD per repo; AI assistants maintain shared context via `AGENTS.md` and `behavioral.md`.
41
41
 
42
42
  ---
43
43
 
@@ -17,7 +17,7 @@ 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
- - 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.
20
+ - In a Repo Nexus workspace: plugin instructions are maintained under `.rnex/plugins/karpathy-llm/` (`rules/behavioral.md` and `instructions/wiki-architecture.md`). Agents read `rnex.yaml` to detect enabled plugins and read their scoped files.
21
21
  - In a standalone setup (outside Repo Nexus):
22
22
  - `AGENTS.md` (universal, works across most harnesses)
23
23
  - `CLAUDE.md` (Claude Code / Anthropic)
@@ -1,83 +0,0 @@
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
- - **Maintenance**: Run the `wiki-lint` workflow (`.rnex/workflows/wiki-lint.md`) to validate paths, update `mentioned_in`, and preserve graph integrity.
60
-
61
- ---
62
-
63
- ## 4. Typed Frontmatter Relation Schema
64
-
65
- Every page in `/wiki/` must maintain typed frontmatter relations:
66
-
67
- ```yaml
68
- ---
69
- title: ""
70
- tags: []
71
- last_updated: YYYY-MM-DD
72
- # Typed relation fields — paths relative to /wiki/
73
- sources: [] # /raw/ files this page was derived from
74
- related: [] # thematically related wiki pages
75
- extends: [] # pages this one builds upon or specialises
76
- contradicts: [] # pages with conflicting information
77
- mentioned_in: [] # pages that link to this one (maintained by lint)
78
- ---
79
- ```
80
-
81
- **Body:** concise summary, key facts or insights, and inline standard Markdown links (`[Label](./path.md)`) where contextually useful in prose.
82
-
83
- The relation graph lives in frontmatter, not in prose links. Agents traverse the graph by reading frontmatter fields, not by scanning body text.
@@ -1,83 +0,0 @@
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
- - **Maintenance**: Run the `wiki-lint` workflow (`.rnex/workflows/wiki-lint.md`) to validate paths, update `mentioned_in`, and preserve graph integrity.
60
-
61
- ---
62
-
63
- ## 4. Typed Frontmatter Relation Schema
64
-
65
- Every page in `/wiki/` must maintain typed frontmatter relations:
66
-
67
- ```yaml
68
- ---
69
- title: ""
70
- tags: []
71
- last_updated: YYYY-MM-DD
72
- # Typed relation fields — paths relative to /wiki/
73
- sources: [] # /raw/ files this page was derived from
74
- related: [] # thematically related wiki pages
75
- extends: [] # pages this one builds upon or specialises
76
- contradicts: [] # pages with conflicting information
77
- mentioned_in: [] # pages that link to this one (maintained by lint)
78
- ---
79
- ```
80
-
81
- **Body:** concise summary, key facts or insights, and inline standard Markdown links (`[Label](./path.md)`) where contextually useful in prose.
82
-
83
- The relation graph lives in frontmatter, not in prose links. Agents traverse the graph by reading frontmatter fields, not by scanning body text.