Add Roo Code context sync: .clinerules symlink and sync script
- Add .clinerules symlink → CLAUDE.md so Roo Code reads same project context - Add sync-context.sh: copies global context to ~/.claude/ for Claude Code and prints content for manual paste into Roo Code Custom Instructions - Update CLAUDE.md: note .clinerules symlink, add sync-context.sh to file list - Update CONTEXT.md: add AI context file mapping table, update file structure - Update README.md: rewrite AI Context Files section to cover both tools, document symlink strategy and sync workflow
This commit is contained in:
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
CLAUDE.md
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
# Ein AI Proxy - Project Context
|
# Ein AI Proxy - Project Context
|
||||||
|
|
||||||
Anthropic-compatible proxy that routes AI requests to multiple providers based on model name: sonnet→GLM-4.7 (Z.ai), opus→Anthropic, haiku→DeepSeek.
|
Anthropic-compatible proxy that routes AI requests to multiple providers based on model name: sonnet→GLM-4.7 (Z.ai), opus→Anthropic, haiku→DeepSeek.
|
||||||
|
`.clinerules` is a symlink to this file so Roo Code reads the same context.
|
||||||
|
|
||||||
## File Structure
|
## File Structure
|
||||||
- `proxy.mjs` - Main proxy server (zero dependencies, Node.js built-ins only)
|
- `proxy.mjs` - Main proxy server (zero dependencies, Node.js built-ins only)
|
||||||
@@ -8,6 +9,7 @@ Anthropic-compatible proxy that routes AI requests to multiple providers based o
|
|||||||
- `config.example.json` - Template config
|
- `config.example.json` - Template config
|
||||||
- `ein-ai-proxy.service` - Systemd unit file
|
- `ein-ai-proxy.service` - Systemd unit file
|
||||||
- `deploy.sh` - Deployment and testing script
|
- `deploy.sh` - Deployment and testing script
|
||||||
|
- `sync-context.sh` - Syncs global context to Claude Code and Roo Code
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
Run locally: `node proxy.mjs` (requires `config.json`)
|
Run locally: `node proxy.mjs` (requires `config.json`)
|
||||||
|
|||||||
+15
-1
@@ -161,6 +161,16 @@ Three profiles configured:
|
|||||||
| "opus" | claude-opus-4-6 | Anthropic Opus | ON | 1M context enabled |
|
| "opus" | claude-opus-4-6 | Anthropic Opus | ON | 1M context enabled |
|
||||||
| "cheap" | claude-haiku-4-5 | DeepSeek V3.2 | OFF | Fast/cheap tasks |
|
| "cheap" | claude-haiku-4-5 | DeepSeek V3.2 | OFF | Fast/cheap tasks |
|
||||||
|
|
||||||
|
### AI Context File Mapping
|
||||||
|
Both Claude Code and Roo Code use context files, but with different conventions:
|
||||||
|
|
||||||
|
| Level | Claude Code | Roo Code | Source of truth |
|
||||||
|
|-------|-------------|----------|-----------------|
|
||||||
|
| Project | `CLAUDE.md` | `.clinerules` (symlink → CLAUDE.md) | `CLAUDE.md` |
|
||||||
|
| Global | `~/.claude/CLAUDE.md` | Custom Instructions in Roo UI | `global-claude-md/CLAUDE.md` |
|
||||||
|
|
||||||
|
Run `./sync-context.sh` from the repo root to sync global context to both tools.
|
||||||
|
|
||||||
## Proxy Internals
|
## Proxy Internals
|
||||||
|
|
||||||
### File Structure
|
### File Structure
|
||||||
@@ -171,10 +181,14 @@ Three profiles configured:
|
|||||||
├── config.example.json # Template config
|
├── config.example.json # Template config
|
||||||
├── ein-ai-proxy.service # Systemd unit file
|
├── ein-ai-proxy.service # Systemd unit file
|
||||||
├── deploy.sh # Deployment script
|
├── deploy.sh # Deployment script
|
||||||
|
├── sync-context.sh # Syncs global context to Claude Code & Roo Code
|
||||||
├── package.json # Package metadata
|
├── package.json # Package metadata
|
||||||
├── .gitignore # Excludes config.json
|
├── .gitignore # Excludes config.json
|
||||||
├── CONTEXT.md # This file
|
├── CONTEXT.md # This file
|
||||||
├── CLAUDE.md # Project-level context
|
├── CLAUDE.md # Project-level context (Claude Code)
|
||||||
|
├── .clinerules # Symlink → CLAUDE.md (Roo Code)
|
||||||
|
├── global-claude-md/ # Global context source of truth
|
||||||
|
│ └── CLAUDE.md # Synced to ~/.claude/ and Roo Custom Instructions
|
||||||
└── README.md # Public documentation
|
└── README.md # Public documentation
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -212,31 +212,44 @@ To route additional models, add entries to the `MODEL_ROUTES` object in `proxy.m
|
|||||||
|
|
||||||
## AI Context Files
|
## AI Context Files
|
||||||
|
|
||||||
This repo includes context files for AI coding agents (Claude Code CLI and Roo Code). There are three levels:
|
This repo includes context files for both **Claude Code CLI** and **Roo Code** (VS Code). The two tools use different file conventions, so we keep them in sync:
|
||||||
|
|
||||||
| File | Scope | Loaded when... |
|
### Project-level context
|
||||||
|
|
||||||
|
| Claude Code reads | Roo Code reads | Source of truth |
|
||||||
|---|---|---|
|
|---|---|---|
|
||||||
| `CLAUDE.md` | Project-level | AI agent is working inside this repo |
|
| `CLAUDE.md` | `.clinerules` | `CLAUDE.md` |
|
||||||
| `CONTEXT.md` | Project-level | Referenced from CLAUDE.md; agent reads on demand |
|
| `CONTEXT.md` | `CONTEXT.md` | `CONTEXT.md` |
|
||||||
| `global-claude-md/CLAUDE.md` | User-level | Every AI session, regardless of project |
|
|
||||||
|
|
||||||
**`global-claude-md/CLAUDE.md`** is the source of truth for the global file. It gets copied to `~/.claude/CLAUDE.md` on each machine. To update it:
|
`.clinerules` is a **git-tracked symlink** pointing to `CLAUDE.md`. Both tools read the same content from the same source — edit `CLAUDE.md` and both stay in sync automatically.
|
||||||
|
|
||||||
|
`CONTEXT.md` is the detailed infrastructure reference. Both tools can read it directly when needed.
|
||||||
|
|
||||||
|
### Global context
|
||||||
|
|
||||||
|
| Claude Code | Roo Code |
|
||||||
|
|---|---|
|
||||||
|
| `~/.claude/CLAUDE.md` (file on disk) | Custom Instructions setting (in Roo Code UI) |
|
||||||
|
|
||||||
|
The source of truth is `global-claude-md/CLAUDE.md` in this repo. To update both tools, run the sync script:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Edit the source in this repo
|
# 1. Edit the source
|
||||||
vim global-claude-md/CLAUDE.md
|
vim global-claude-md/CLAUDE.md
|
||||||
|
|
||||||
# 2. Commit and push
|
# 2. Commit and push
|
||||||
git add -A && git commit -m "Update global CLAUDE.md" && git push
|
git add -A && git commit -m "Update global context" && git push
|
||||||
|
|
||||||
# 3. Copy to work laptop
|
# 3. Sync to both tools
|
||||||
cp global-claude-md/CLAUDE.md ~/.claude/CLAUDE.md
|
./sync-context.sh
|
||||||
|
|
||||||
# 4. Copy to mini-server
|
|
||||||
scp global-claude-md/CLAUDE.md mini-server:~/.claude/CLAUDE.md
|
|
||||||
```
|
```
|
||||||
|
|
||||||
The project-level files (`CLAUDE.md` and `CONTEXT.md`) are picked up automatically when an AI agent opens this repo — no copying needed.
|
The script copies the file to `~/.claude/CLAUDE.md` (for Claude Code) and prints the content for you to paste into Roo Code's Custom Instructions (Roo sidebar → gear icon → Custom Instructions).
|
||||||
|
|
||||||
|
To also update mini-server's Claude Code:
|
||||||
|
```bash
|
||||||
|
scp global-claude-md/CLAUDE.md mini-server:~/.claude/CLAUDE.md
|
||||||
|
```
|
||||||
|
|
||||||
## Files
|
## Files
|
||||||
|
|
||||||
@@ -247,10 +260,12 @@ The project-level files (`CLAUDE.md` and `CONTEXT.md`) are picked up automatical
|
|||||||
| `config.example.json` | Template config — copy to `config.json` and fill in |
|
| `config.example.json` | Template config — copy to `config.json` and fill in |
|
||||||
| `ein-ai-proxy.service` | Systemd unit file for running as a service |
|
| `ein-ai-proxy.service` | Systemd unit file for running as a service |
|
||||||
| `deploy.sh` | Deployment script — validates config, tests proxy, installs service |
|
| `deploy.sh` | Deployment script — validates config, tests proxy, installs service |
|
||||||
|
| `sync-context.sh` | Syncs global AI context to Claude Code and Roo Code |
|
||||||
| `package.json` | Package metadata (no dependencies) |
|
| `package.json` | Package metadata (no dependencies) |
|
||||||
| `CLAUDE.md` | Project-level context loaded by AI coding agents |
|
| `CLAUDE.md` | Project-level context for Claude Code |
|
||||||
|
| `.clinerules` | Symlink → `CLAUDE.md` — project-level context for Roo Code |
|
||||||
| `CONTEXT.md` | Full infrastructure documentation (network, servers, operations) |
|
| `CONTEXT.md` | Full infrastructure documentation (network, servers, operations) |
|
||||||
| `global-claude-md/CLAUDE.md` | User-level context to copy to `~/.claude/CLAUDE.md` |
|
| `global-claude-md/CLAUDE.md` | Source of truth for global context (both tools) |
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
Executable
+42
@@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# =============================================================
|
||||||
|
# Sync global AI context to Claude Code and Roo Code
|
||||||
|
#
|
||||||
|
# Source of truth: global-claude-md/CLAUDE.md
|
||||||
|
#
|
||||||
|
# This script:
|
||||||
|
# 1. Copies to ~/.claude/CLAUDE.md (Claude Code CLI reads this)
|
||||||
|
# 2. Prints content for manual paste into Roo Code Custom Instructions
|
||||||
|
# =============================================================
|
||||||
|
set -e
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
SOURCE="$SCRIPT_DIR/global-claude-md/CLAUDE.md"
|
||||||
|
|
||||||
|
if [ ! -f "$SOURCE" ]; then
|
||||||
|
echo "[!] Source file not found: $SOURCE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# --- Claude Code CLI ---
|
||||||
|
CLAUDE_DIR="$HOME/.claude"
|
||||||
|
CLAUDE_TARGET="$CLAUDE_DIR/CLAUDE.md"
|
||||||
|
|
||||||
|
mkdir -p "$CLAUDE_DIR"
|
||||||
|
cp "$SOURCE" "$CLAUDE_TARGET"
|
||||||
|
echo "[✓] Claude Code: copied to $CLAUDE_TARGET"
|
||||||
|
|
||||||
|
# --- Roo Code (VS Code) ---
|
||||||
|
echo ""
|
||||||
|
echo "============================================"
|
||||||
|
echo " Roo Code: Manual Step Required"
|
||||||
|
echo "============================================"
|
||||||
|
echo ""
|
||||||
|
echo "Copy the text between the lines below, then paste it into:"
|
||||||
|
echo " Roo Code sidebar → Settings (gear icon) → Custom Instructions"
|
||||||
|
echo ""
|
||||||
|
echo "────────────────────────────────────────────"
|
||||||
|
cat "$SOURCE"
|
||||||
|
echo "────────────────────────────────────────────"
|
||||||
|
echo ""
|
||||||
|
echo "Done. Both tools are now in sync."
|
||||||
Reference in New Issue
Block a user