rex-claude 1.0.0
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 +163 -0
- package/activity/activity.jsonl +401 -0
- package/activity/config.lua +3 -0
- package/activity/init.lua +49 -0
- package/dist/cli.js +204 -0
- package/dotfiles/CLAUDE.md +136 -0
- package/dotfiles/commands/clean.md +8 -0
- package/dotfiles/commands/doc.md +8 -0
- package/dotfiles/commands/review.md +15 -0
- package/dotfiles/commands/scaffold.md +11 -0
- package/dotfiles/commands/test.md +11 -0
- package/dotfiles/docs/cloudflare.md +62 -0
- package/dotfiles/docs/nextjs.md +79 -0
- package/dotfiles/docs/react.md +63 -0
- package/dotfiles/docs/tailwind.md +45 -0
- package/dotfiles/docs/telegram-bot.md +55 -0
- package/dotfiles/rules/api-design.md +63 -0
- package/dotfiles/rules/defensive-engineering.md +42 -0
- package/dotfiles/rules/docs-first.md +47 -0
- package/dotfiles/rules/frontend.md +41 -0
- package/dotfiles/rules/git-workflow.md +57 -0
- package/dotfiles/rules/never-assume.md +39 -0
- package/dotfiles/rules/security.md +46 -0
- package/dotfiles/rules/testing.md +33 -0
- package/dotfiles/settings.json +69 -0
- package/dotfiles/skills/build-validate/SKILL.md +16 -0
- package/dotfiles/skills/code-review/SKILL.md +18 -0
- package/dotfiles/skills/context-loader/SKILL.md +25 -0
- package/dotfiles/skills/debug-assist/SKILL.md +26 -0
- package/dotfiles/skills/deploy-checklist/SKILL.md +54 -0
- package/dotfiles/skills/dstudio-design-system/SKILL.md +120 -0
- package/dotfiles/skills/figma-workflow/SKILL.md +23 -0
- package/dotfiles/skills/fix-issue/SKILL.md +43 -0
- package/dotfiles/skills/one-shot/SKILL.md +18 -0
- package/dotfiles/skills/pr-review-loop/SKILL.md +41 -0
- package/dotfiles/skills/project-init/SKILL.md +45 -0
- package/dotfiles/skills/research/SKILL.md +17 -0
- package/dotfiles/skills/spec-interview/SKILL.md +20 -0
- package/dotfiles/skills/token-guard/SKILL.md +26 -0
- package/dotfiles/templates/CLAUDE.md.template +39 -0
- package/memory/package.json +24 -0
- package/memory/src/embed.ts +23 -0
- package/memory/src/ingest.ts +257 -0
- package/memory/src/search.ts +32 -0
- package/memory/src/server.ts +69 -0
- package/memory/tsconfig.json +14 -0
- package/package.json +39 -0
- package/tmux/.tmux.conf +73 -0
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# REX — Senior Dev Companion
|
|
2
|
+
|
|
3
|
+
Config unifiée Claude Code + MCP memory server + activity logger pour Kevin (D-Studio).
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
rex/
|
|
9
|
+
├── dotfiles/ # Claude Code config (symlinked → ~/.claude/)
|
|
10
|
+
│ ├── CLAUDE.md # Instructions globales REX
|
|
11
|
+
│ ├── settings.json # MCP servers, hooks, plugins
|
|
12
|
+
│ ├── commands/ # Slash commands custom
|
|
13
|
+
│ ├── rules/ # Règles auto-chargées au boot (7 fichiers)
|
|
14
|
+
│ ├── skills/ # Skills on-demand (8 skills)
|
|
15
|
+
│ ├── agents/ # Vide — migré vers skills
|
|
16
|
+
│ ├── docs/ # Cache docs frameworks (chargé on-demand)
|
|
17
|
+
│ └── templates/ # Templates de projets
|
|
18
|
+
├── memory/ # MCP Server REX-Memory
|
|
19
|
+
│ ├── src/
|
|
20
|
+
│ │ ├── server.ts # 3 tools MCP : rex_search, rex_learn, rex_context
|
|
21
|
+
│ │ ├── ingest.ts # Parse sessions JSONL → SQLite + embeddings
|
|
22
|
+
│ │ ├── embed.ts # Embeddings via Ollama (qwen3-embedding:4b)
|
|
23
|
+
│ │ └── search.ts # Recherche sémantique sqlite-vec
|
|
24
|
+
│ ├── db/ # SQLite DB (gitignored)
|
|
25
|
+
│ ├── package.json
|
|
26
|
+
│ └── tsconfig.json
|
|
27
|
+
├── activity/ # Hammerspoon activity logger
|
|
28
|
+
│ ├── init.lua # Log app switches → JSONL
|
|
29
|
+
│ └── config.lua # Config (chemin de log, intervalle)
|
|
30
|
+
├── install.sh # Setup complet en 1 commande
|
|
31
|
+
├── package.json
|
|
32
|
+
└── .gitignore
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
cd ~/Documents/Developer/_config/rex
|
|
39
|
+
./install.sh
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Le script :
|
|
43
|
+
1. Crée les symlinks `dotfiles/*` → `~/.claude/`
|
|
44
|
+
2. `npm install` dans memory/
|
|
45
|
+
3. Build le MCP server (`npm run build`)
|
|
46
|
+
4. Copie la config Hammerspoon
|
|
47
|
+
5. Enregistre le MCP server dans `~/.claude/settings.json`
|
|
48
|
+
|
|
49
|
+
## MCP Server — REX Memory
|
|
50
|
+
|
|
51
|
+
### Tools disponibles
|
|
52
|
+
|
|
53
|
+
| Tool | Usage |
|
|
54
|
+
|------|-------|
|
|
55
|
+
| `rex_search(query)` | Recherche sémantique dans les sessions passées et faits mémorisés |
|
|
56
|
+
| `rex_learn(fact, category)` | Mémorise un pattern, debug insight, ou préférence |
|
|
57
|
+
| `rex_context(project_path)` | Retourne le contexte pertinent pour le projet courant |
|
|
58
|
+
|
|
59
|
+
### Stack technique
|
|
60
|
+
|
|
61
|
+
- **DB** : SQLite + [sqlite-vec](https://github.com/asg017/sqlite-vec) pour la recherche vectorielle
|
|
62
|
+
- **Embeddings** : Ollama local avec `qwen3-embedding:4b` (2560 dimensions)
|
|
63
|
+
- **Ingestion** : parse les JSONL de `~/.claude/projects/`, extrait messages + tool_use + metadata
|
|
64
|
+
- **Fix notable** : `CAST(? AS INTEGER)` pour contourner un bug sqlite-vec avec les BigInt rowid
|
|
65
|
+
|
|
66
|
+
### Ingestion manuelle
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
cd memory && npm run ingest
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Ingestion automatique
|
|
73
|
+
|
|
74
|
+
Un LaunchAgent macOS tourne toutes les heures :
|
|
75
|
+
- Fichier : `~/Library/LaunchAgents/com.dstudio.rex-ingest.plist`
|
|
76
|
+
- Logs : `/tmp/rex-ingest.log`
|
|
77
|
+
- RunAtLoad : oui (se lance au démarrage du Mac)
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
# Vérifier le status
|
|
81
|
+
launchctl list | grep rex
|
|
82
|
+
|
|
83
|
+
# Forcer une exécution
|
|
84
|
+
launchctl kickstart gui/$(id -u)/com.dstudio.rex-ingest
|
|
85
|
+
|
|
86
|
+
# Voir les logs
|
|
87
|
+
tail -f /tmp/rex-ingest.log
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Activity Logger (Hammerspoon)
|
|
91
|
+
|
|
92
|
+
Log les changements d'app active en JSONL :
|
|
93
|
+
- **Quoi** : app name, durée, timestamps
|
|
94
|
+
- **Pas de keylogger** (privacy)
|
|
95
|
+
- **Fichier** : `rex/activity/activity.jsonl`
|
|
96
|
+
- **Chargé via** : `~/.hammerspoon/init.lua` → `rex/activity/init.lua`
|
|
97
|
+
|
|
98
|
+
## Skills (chargés on-demand)
|
|
99
|
+
|
|
100
|
+
| Skill | Description |
|
|
101
|
+
|-------|-------------|
|
|
102
|
+
| `rex-boot` | Briefing de session — auto-détecte projet, git, PRs, demande l'objectif |
|
|
103
|
+
| `context-loader` | Charge docs + CLAUDE.md + mémoire REX avant de bosser |
|
|
104
|
+
| `debug-assist` | Debugging systématique — parse erreur, cherche dans mémoire, root cause |
|
|
105
|
+
| `token-guard` | Audit du contexte — fichiers redondants, sorties trop longues, suggestions /compact |
|
|
106
|
+
| `project-init` | Init un nouveau projet avec CLAUDE.md, git, docs cache |
|
|
107
|
+
| `build-validate` | Vérifie build, lint, tests, dev server — reporte sans modifier |
|
|
108
|
+
| `code-review` | Review de code : logique, sécu, perf, TypeScript strictness |
|
|
109
|
+
| `one-shot` | Génère un projet complet Next.js + Shadcn en une passe |
|
|
110
|
+
|
|
111
|
+
## Rules (chargées au boot, ~370 lignes total)
|
|
112
|
+
|
|
113
|
+
| Fichier | Contenu |
|
|
114
|
+
|---------|---------|
|
|
115
|
+
| `defensive-engineering.md` | Scale, pagination, rate limits, error handling |
|
|
116
|
+
| `api-design.md` | REST conventions, response envelopes, status codes |
|
|
117
|
+
| `frontend.md` | Loading/empty/error states, SSR, hydration, forms, a11y |
|
|
118
|
+
| `security.md` | OWASP, secrets, SQL injection, XSS, CORS, auth |
|
|
119
|
+
| `testing.md` | Test discipline, build verification, mocking |
|
|
120
|
+
| `git-workflow.md` | Commit conventions, branching, PR process |
|
|
121
|
+
| `never-assume.md` | Règles anti-erreurs, alternatives obligatoires |
|
|
122
|
+
| `docs-first.md` | Documentation-first, cache local, Context7 |
|
|
123
|
+
|
|
124
|
+
## Docs Cache (~/.claude/docs/)
|
|
125
|
+
|
|
126
|
+
Fichiers de patterns/gotchas pré-chargés (lus on-demand uniquement) :
|
|
127
|
+
|
|
128
|
+
- `nextjs.md` — App Router, SSR, caching, middleware
|
|
129
|
+
- `react.md` — Hooks, patterns, performance
|
|
130
|
+
- `cloudflare.md` — Workers, D1, KV, limites
|
|
131
|
+
- `telegram-bot.md` — Bot API, rate limits, webhooks
|
|
132
|
+
- `tailwind.md` — Classes utilitaires, responsive, dark mode
|
|
133
|
+
|
|
134
|
+
## Plugins Claude Code
|
|
135
|
+
|
|
136
|
+
| Plugin | Status | Notes |
|
|
137
|
+
|--------|--------|-------|
|
|
138
|
+
| Playwright | Actif | Browser automation, tests E2E |
|
|
139
|
+
| Frontend Design | Actif | UI/design quality |
|
|
140
|
+
| Figma | **Désactivé** | Réactiver manuellement quand besoin (auth pénible) |
|
|
141
|
+
| Superpowers | Actif | Capacités étendues |
|
|
142
|
+
| Trail of Bits (x4) | Actif | Sécurité : static analysis, semgrep, audit, insecure defaults |
|
|
143
|
+
| Vercel | Désactivé | Pas utilisé |
|
|
144
|
+
| Ralph Loop | Désactivé | Pas utilisé |
|
|
145
|
+
|
|
146
|
+
Pour activer/désactiver : éditer `~/.claude/settings.json` > `enabledPlugins`.
|
|
147
|
+
|
|
148
|
+
## Services auto-start au boot Mac
|
|
149
|
+
|
|
150
|
+
| Service | Méthode | Vérification |
|
|
151
|
+
|---------|---------|-------------|
|
|
152
|
+
| Ollama | Login Items macOS | `pgrep ollama` |
|
|
153
|
+
| Hammerspoon | Login Items macOS | Icône menubar |
|
|
154
|
+
| REX Ingest | LaunchAgent (hourly) | `launchctl list \| grep rex` |
|
|
155
|
+
| MCP Server | Claude Code (auto) | Démarre avec Claude |
|
|
156
|
+
|
|
157
|
+
## Historique des décisions
|
|
158
|
+
|
|
159
|
+
1. **agents → skills** : les agents se chargent entièrement au boot (~500 tokens chacun), les skills ne chargent que les métadonnées (~700 tokens pour les 8). Économie significative.
|
|
160
|
+
2. **docs on-demand** : les fichiers `~/.claude/docs/` ne sont jamais lus au boot, seulement quand le framework est pertinent pour la tâche en cours.
|
|
161
|
+
3. **sqlite-vec CAST workaround** : le rowid en BigInt de `better-sqlite3` est rejeté par sqlite-vec. Fix : `CAST(? AS INTEGER)` dans le SQL.
|
|
162
|
+
4. **Figma désactivé par défaut** : re-auth fréquente, activé manuellement quand besoin.
|
|
163
|
+
5. **qwen3-embedding:4b** : modèle d'embedding local via Ollama, 2560 dimensions, déjà installé.
|