@a13xu/lucid 1.16.0 → 1.16.1

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
@@ -4,11 +4,11 @@
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@a13xu/lucid)](https://www.npmjs.com/package/@a13xu/lucid)
5
5
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
6
 
7
- > **MCP server for Claude Code** — persistent memory, smart code indexing, and code quality validation. Works out of the box with zero configuration.
7
+ > **MCP server for Claude Code** — persistent memory, smart code indexing, model selection, and code quality validation. Works out of the box with zero configuration.
8
8
 
9
9
  Token-efficient memory, code indexing, and validation for Claude Code agents — backed by **SQLite + FTS5**.
10
10
 
11
- Stores a persistent knowledge graph (entities, relations, observations), indexes source files as compressed binary with change detection, retrieves minimal relevant context via TF-IDF or Qdrant, and validates code for LLM drift patterns. Supports TypeScript, JavaScript, Python, **Vue, Nuxt**.
11
+ Stores a persistent knowledge graph (entities, relations, observations), indexes source files as compressed binary with change detection, retrieves minimal relevant context via TF-IDF or Qdrant, and validates code for LLM drift patterns. Supports TypeScript, JavaScript, Python, **Vue, Nuxt**. Optional **LLMLingua-2 semantic compression** reduces context tokens by 30–70% while preserving meaning.
12
12
 
13
13
  ## Install
14
14
 
@@ -45,15 +45,16 @@ Default DB path: `~/.claude/memory.db`
45
45
  ## Quick start
46
46
 
47
47
  ```
48
- 1. "Index this project" → init_project() → scans CLAUDE.md, package.json, src/**
49
- 2. Write code → sync_file(path) → compressed + hashed + diff stored
50
- 3. "What's relevant?" → get_context("auth flow") TF-IDF ranked skeletons, ~500 tokens
51
- 4. "What changed?" get_recent(hours=2) line diffs of recent edits
52
- 5. "Where is X used?" grep_code("X") matching lines only, ~30 tokens
53
- 6. "What do we know?" → recall("query") knowledge graph search
48
+ 1. "Index this project" → init_project() → scans CLAUDE.md, package.json, src/**
49
+ 2. Write code → sync_file(path) → compressed + hashed + diff stored
50
+ 3. "What's relevant?" → smart_context("auth flow") recall + code in one call, adaptive budget
51
+ 4. "What model?" suggest_model("refactor auth") haiku (lookup) or sonnet (reasoning)
52
+ 5. "What changed?" get_recent(hours=2) line diffs of recent edits
53
+ 6. "Where is X used?" → grep_code("X") matching lines only, ~30 tokens
54
+ 7. "What do we know?" → recall("query") → knowledge graph search
54
55
  ```
55
56
 
56
- ## Tools (30)
57
+ ## Tools (37)
57
58
 
58
59
  ### Memory
59
60
  | Tool | Description |
@@ -76,8 +77,11 @@ Default DB path: `~/.claude/memory.db`
76
77
  ### Token optimization
77
78
  | Tool | Description |
78
79
  |---|---|
79
- | `get_context` | **Smart context retrieval.** Ranks all indexed files by TF-IDF relevance (or Qdrant vector search if `QDRANT_URL` is set), applies recency boost, returns skeletons (imports + signatures only) for large files. Respects `maxContextTokens` budget. |
80
+ | `smart_context` | **Recommended entry point.** Combines `recall()` (knowledge graph) + `get_context()` (code files) in one call. Adaptive token budget: `simple`=2000, `moderate`=6000, `complex`=12000. Logs an experience for `reward()`/`penalize()` feedback. |
81
+ | `suggest_model` | Classify task complexity → recommend Claude model. Returns `{ model, model_id, reasoning, context_budget }`. Simple lookups → Haiku; reasoning/code → Sonnet. Call at the start of any workflow. |
82
+ | `get_context` | **Classic code context.** Ranks indexed files by TF-IDF (or Qdrant), applies recency boost, returns skeletons for large files. Respects `maxContextTokens` budget. |
80
83
  | `get_recent` | Return files modified in the last N hours with line-level diffs. |
84
+ | `compress_text` | Compress any text using LLMLingua-2 semantic compression. Returns compressed text + stats (ratio, tokens saved). Model downloads ~700MB on first use. |
81
85
 
82
86
  ### Logic Guardian
83
87
  | Tool | Description |
@@ -86,11 +90,19 @@ Default DB path: `~/.claude/memory.db`
86
90
  | `check_drift` | Analyze a code snippet inline without saving to disk. |
87
91
  | `get_checklist` | Return the full 5-pass validation protocol (Logic Trace, Contract Verification, Stupid Mistakes, Integration Sanity, Explain It). |
88
92
 
93
+ ### Plans
94
+ | Tool | Description |
95
+ |---|---|
96
+ | `plan_create` | Create a development plan with title, description, and tasks. Returns plan ID. |
97
+ | `plan_list` | List all plans with status summary (total/done/in-progress tasks). |
98
+ | `plan_get` | Get full plan details including all tasks and their status. |
99
+ | `plan_update_task` | Update a task's status (`todo` → `in_progress` → `done`) and optionally add notes. |
100
+
89
101
  ### Reward system
90
102
  | Tool | Description |
91
103
  |---|---|
92
- | `reward` | Signal that the last `get_context()` result was helpful (+1). Rewarded files rank higher in future similar queries. |
93
- | `penalize` | Signal that the last `get_context()` result was unhelpful (-1). Penalized files rank lower in future queries. |
104
+ | `reward` | Signal that the last `smart_context()`/`get_context()` result was helpful (+1). Rewarded files rank higher in future similar queries. |
105
+ | `penalize` | Signal that the last result was unhelpful (-1). Penalized files rank lower. Accepts optional `note` to log what was missing. |
94
106
  | `show_rewards` | Show top rewarded experiences and most rewarded files. Rewards decay exponentially (half-life ~14 days). |
95
107
 
96
108
  ### Code Quality Guard
@@ -115,7 +127,31 @@ Default DB path: `~/.claude/memory.db`
115
127
 
116
128
  ## Token optimization in depth
117
129
 
118
- ### How `get_context` works
130
+ ### How `smart_context` works (recommended)
131
+
132
+ ```
133
+ query: "auth middleware"
134
+
135
+ 1. recall(query) — knowledge graph search (entities, relations)
136
+
137
+ 2. TF-IDF score all indexed files against query
138
+ (or Qdrant top-k if QDRANT_URL is set)
139
+
140
+ 3. Boost recently-modified files (+0.3 score)
141
+ Boost rewarded files (+0.25 score, decayed)
142
+
143
+ 4. For each file within token budget:
144
+ file < maxTokensPerFile → return full source
145
+ file > maxTokensPerFile → return skeleton only
146
+ (imports + signatures + TODOs)
147
+ + relevant fragments around query terms
148
+
149
+ 5. Optional: LLMLingua-2 compression (if enabled in config)
150
+
151
+ output: merged knowledge + code — budget: 2k/6k/12k by task_type
152
+ ```
153
+
154
+ ### How `get_context` works (classic)
119
155
 
120
156
  ```
121
157
  query: "auth middleware"
@@ -183,6 +219,32 @@ Or in `.mcp.json`:
183
219
 
184
220
  Falls back to TF-IDF automatically if Qdrant is unreachable.
185
221
 
222
+ ### Semantic compression (optional)
223
+
224
+ LLMLingua-2 (`microsoft/llmlingua-2-bert-base-multilingual-cased-meetingbank`) identifies and drops semantically unimportant tokens before returning context to Claude — and before generating Qdrant embeddings.
225
+
226
+ Enable in `lucid.config.json`:
227
+
228
+ ```json
229
+ {
230
+ "semanticCompression": {
231
+ "enabled": true,
232
+ "ratio": 0.5,
233
+ "minLength": 300,
234
+ "applyToEmbeddings": true
235
+ }
236
+ }
237
+ ```
238
+
239
+ | Key | Default | Description |
240
+ |---|---|---|
241
+ | `enabled` | `false` | Opt-in — model downloads ~700MB on first use |
242
+ | `ratio` | `0.5` | Fraction of tokens to keep (0.3 = keep 30%) |
243
+ | `minLength` | `300` | Skip compression for texts shorter than this |
244
+ | `applyToEmbeddings` | `true` | Also compress chunk text before Qdrant embedding |
245
+
246
+ Model is cached in `~/.lucid/models/` after first download. Falls back to uncompressed text on any error — safe to enable unconditionally.
247
+
186
248
  ### Configuration (`lucid.config.json`)
187
249
 
188
250
  Create in your project root to customize behavior:
@@ -191,9 +253,13 @@ Create in your project root to customize behavior:
191
253
  {
192
254
  "whitelistDirs": ["src", "backend", "api"],
193
255
  "blacklistDirs": ["migrations", "fixtures"],
194
- "maxTokensPerFile": 400,
195
- "maxContextTokens": 6000,
196
- "recentWindowHours": 12
256
+ "maxTokensPerFile": 600,
257
+ "maxContextTokens": 8000,
258
+ "recentWindowHours": 48,
259
+ "semanticCompression": {
260
+ "enabled": false,
261
+ "ratio": 0.5
262
+ }
197
263
  }
198
264
  ```
199
265
 
@@ -201,9 +267,9 @@ Create in your project root to customize behavior:
201
267
  |---|---|---|
202
268
  | `whitelistDirs` | — | Only index/return files from these dirs |
203
269
  | `blacklistDirs` | — | Extra dirs to skip (merged with built-in skips) |
204
- | `maxTokensPerFile` | `400` | Files above this get skeleton treatment |
205
- | `maxContextTokens` | `4000` | Total token budget for `get_context` |
206
- | `recentWindowHours` | `24` | "Recently touched" threshold |
270
+ | `maxTokensPerFile` | `600` | Files above this get skeleton treatment |
271
+ | `maxContextTokens` | `8000` | Total token budget for `get_context` |
272
+ | `recentWindowHours` | `48` | "Recently touched" threshold |
207
273
 
208
274
  ## Why no vectors by default?
209
275
 
@@ -237,6 +303,63 @@ TF-IDF is fast, deterministic, and requires zero external services. Qdrant is av
237
303
  ## Relation types
238
304
  `uses` · `depends_on` · `created_by` · `part_of` · `replaced_by` · `conflicts_with` · `tested_by`
239
305
 
306
+ ## HTTP daemon & auto-sync
307
+
308
+ Lucid can run as a background HTTP daemon (port 7821) for auto-syncing files without Claude's cooperation.
309
+
310
+ ```bash
311
+ # Start daemon (watches for sync requests, serves REST API)
312
+ lucid watch
313
+
314
+ # With HTTP server
315
+ lucid watch --http
316
+
317
+ # Check status
318
+ lucid status
319
+
320
+ # Stop
321
+ lucid stop
322
+ ```
323
+
324
+ ### REST API (when `--http` is active)
325
+
326
+ | Endpoint | Description |
327
+ |---|---|
328
+ | `POST /sync` `{ path }` | Sync a single file |
329
+ | `POST /sync-project` `{ directory? }` | Sync entire project |
330
+ | `GET /context?q=<query>` | Get context via HTTP |
331
+ | `POST /validate` `{ path }` | Validate file for drift |
332
+ | `GET /health` | Daemon health check |
333
+
334
+ ### Auto-sync hook (`lucid-sync`)
335
+
336
+ `init_project` installs a Claude Code `PostToolUse` hook that calls `lucid-sync` after every file write/edit. The sync binary:
337
+
338
+ 1. Tries HTTP sync (500ms timeout, if daemon running)
339
+ 2. Falls back to direct SQLite sync (no daemon needed)
340
+
341
+ This keeps the knowledge graph current automatically — without relying on Claude remembering to call `sync_file`.
342
+
343
+ ## Skills enforcement
344
+
345
+ Lucid ships **enforcement skills** that install globally into `~/.claude/skills/` and activate in every project:
346
+
347
+ | Skill | Purpose |
348
+ |---|---|
349
+ | `lucid-start` | Session start — `get_recent` + `smart_context` before any coding |
350
+ | `lucid-context` | Pre-task context loading — `suggest_model` + `smart_context` |
351
+ | `lucid-audit` | Pre-done gate — validate + check drift before marking complete |
352
+ | `lucid-plan` | Planning workflow |
353
+ | `lucid-sync` | Post-edit sync reminder |
354
+ | `lucid-webdev` | Web dev workflow with context |
355
+
356
+ All skills use `<HARD-GATE>` blocks that prevent proceeding until required tools are called.
357
+
358
+ Install globally:
359
+ ```bash
360
+ init_project() # installs skills to ~/.claude/skills/ automatically
361
+ ```
362
+
240
363
  ## Debugging
241
364
 
242
365
  ```bash
@@ -244,7 +367,7 @@ echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"capabilities":{},
244
367
  | npx @a13xu/lucid
245
368
  ```
246
369
 
247
- In Claude Code: run `/mcp` — you should see `lucid` with 20 tools.
370
+ In Claude Code: run `/mcp` — you should see `lucid` with 37 tools.
248
371
 
249
372
  ## Contributing
250
373
 
@@ -260,8 +383,11 @@ Bug reports and pull requests are welcome on [GitHub](https://github.com/a13xu/l
260
383
  - **Runtime:** Node.js 18+, TypeScript, ES modules
261
384
  - **MCP SDK:** `@modelcontextprotocol/sdk`
262
385
  - **Database:** `better-sqlite3` (synchronous, WAL mode)
263
- - **Compression:** Node.js built-in `zlib` (deflate level 9)
386
+ - **Compression:** Node.js built-in `zlib` (deflate level 9) + LLMLingua-2 semantic compression (optional)
264
387
  - **Hashing:** SHA-256 via `crypto` (change detection)
265
388
  - **Ranking:** TF-IDF (built-in) or Qdrant (optional, via REST)
389
+ - **Semantic compression:** `@huggingface/transformers` (ONNX Runtime, q8 quantization)
390
+ - **HTTP daemon:** Express 5 on port 7821 (optional)
391
+ - **File watcher:** `chokidar`
266
392
  - **Validation:** `zod`
267
393
  - **Transport:** stdio
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a13xu/lucid",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "Token-efficient memory, code indexing, and validation for Claude Code agents — SQLite + FTS5, TF-IDF + Qdrant retrieval, AST skeleton pruning, diff-aware context, Logic Guardian drift detection",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,73 +1,73 @@
1
- ---
2
- name: lucid-audit
3
- description: MANDATORY before marking any task done — runs Logic Guardian + Code Quality checks. HARD-GATE blocks completion without validation.
4
- argument-hint: "[file path or 'all changed files']"
5
- ---
6
-
7
- <HARD-GATE>
8
- You are about to say "done", "fixed", "complete", or "implemented".
9
- STOP. You have NOT verified the code yet.
10
-
11
- Do NOT mark any task as done, do NOT commit, do NOT say the work is complete
12
- until you have run BOTH validators below and fixed all 🔴 CRITICAL issues.
13
-
14
- "It looks correct" is not verification. Run the tools.
15
- </HARD-GATE>
16
-
17
- ## When to invoke
18
-
19
- **INVOKE when:** about to say done/fixed/complete/implemented, before committing, before creating a PR
20
- **DO NOT INVOKE for:** read-only tasks, pure research, config changes with no logic
21
-
22
- ## Steps
23
-
24
- ```dot
25
- digraph lucid_audit {
26
- "About to say done?" -> "validate_file(path)";
27
- "validate_file(path)" -> "Critical issues?";
28
- "Critical issues?" -> "Fix issues" [label="yes 🔴"];
29
- "Fix issues" -> "validate_file(path)";
30
- "Critical issues?" -> "check_code_quality(path)" [label="no ✓"];
31
- "check_code_quality(path)" -> "HIGH issues?";
32
- "HIGH issues?" -> "Fix if safe" [label="yes 🟠"];
33
- "Fix if safe" -> "Mark done ✓";
34
- "HIGH issues?" -> "Mark done ✓" [label="no ✓"];
35
- }
36
- ```
37
-
38
- ### 0. Get model recommendation
39
- ```
40
- suggest_model(task_description="<paste the file path or description of what was written>")
41
- ```
42
- Say: **"Using [model] — [reasoning]"** then proceed.
43
-
44
- ### 1. Validate logic correctness
45
- ```
46
- validate_file(path="<file you wrote or modified>")
47
- ```
48
- Fix every 🔴 CRITICAL issue. Re-run until clean.
49
-
50
- ### 2. Validate code quality
51
- ```
52
- check_code_quality(path="<same file>")
53
- ```
54
- Fix 🔴 HIGH severity issues. Address 🟠 MEDIUM where practical.
55
-
56
- ### 3. For complex logic — get the full checklist
57
- ```
58
- get_checklist()
59
- ```
60
- Run all 5 mental passes before marking done.
61
-
62
- ### 4. Pre-write validation (before writing to disk)
63
- ```
64
- check_drift(code="<your code snippet>", language="typescript")
65
- ```
66
-
67
- ## Severity guide
68
-
69
- | Icon | Level | Action |
70
- |---|---|---|
71
- | 🔴 | Critical/High | Fix immediately — do not proceed |
72
- | 🟠 | Medium | Fix if the refactor is safe |
73
- | 🔵 | Low/Info | Note for future cleanup |
1
+ ---
2
+ name: lucid-audit
3
+ description: MANDATORY before marking any task done — runs Logic Guardian + Code Quality checks. HARD-GATE blocks completion without validation.
4
+ argument-hint: "[file path or 'all changed files']"
5
+ ---
6
+
7
+ <HARD-GATE>
8
+ You are about to say "done", "fixed", "complete", or "implemented".
9
+ STOP. You have NOT verified the code yet.
10
+
11
+ Do NOT mark any task as done, do NOT commit, do NOT say the work is complete
12
+ until you have run BOTH validators below and fixed all 🔴 CRITICAL issues.
13
+
14
+ "It looks correct" is not verification. Run the tools.
15
+ </HARD-GATE>
16
+
17
+ ## When to invoke
18
+
19
+ **INVOKE when:** about to say done/fixed/complete/implemented, before committing, before creating a PR
20
+ **DO NOT INVOKE for:** read-only tasks, pure research, config changes with no logic
21
+
22
+ ## Steps
23
+
24
+ ```dot
25
+ digraph lucid_audit {
26
+ "About to say done?" -> "validate_file(path)";
27
+ "validate_file(path)" -> "Critical issues?";
28
+ "Critical issues?" -> "Fix issues" [label="yes 🔴"];
29
+ "Fix issues" -> "validate_file(path)";
30
+ "Critical issues?" -> "check_code_quality(path)" [label="no ✓"];
31
+ "check_code_quality(path)" -> "HIGH issues?";
32
+ "HIGH issues?" -> "Fix if safe" [label="yes 🟠"];
33
+ "Fix if safe" -> "Mark done ✓";
34
+ "HIGH issues?" -> "Mark done ✓" [label="no ✓"];
35
+ }
36
+ ```
37
+
38
+ ### 0. Get model recommendation
39
+ ```
40
+ suggest_model(task_description="<paste the file path or description of what was written>")
41
+ ```
42
+ Say: **"Using [model] — [reasoning]"** then proceed.
43
+
44
+ ### 1. Validate logic correctness
45
+ ```
46
+ validate_file(path="<file you wrote or modified>")
47
+ ```
48
+ Fix every 🔴 CRITICAL issue. Re-run until clean.
49
+
50
+ ### 2. Validate code quality
51
+ ```
52
+ check_code_quality(path="<same file>")
53
+ ```
54
+ Fix 🔴 HIGH severity issues. Address 🟠 MEDIUM where practical.
55
+
56
+ ### 3. For complex logic — get the full checklist
57
+ ```
58
+ get_checklist()
59
+ ```
60
+ Run all 5 mental passes before marking done.
61
+
62
+ ### 4. Pre-write validation (before writing to disk)
63
+ ```
64
+ check_drift(code="<your code snippet>", language="typescript")
65
+ ```
66
+
67
+ ## Severity guide
68
+
69
+ | Icon | Level | Action |
70
+ |---|---|---|
71
+ | 🔴 | Critical/High | Fix immediately — do not proceed |
72
+ | 🟠 | Medium | Fix if the refactor is safe |
73
+ | 🔵 | Low/Info | Note for future cleanup |
@@ -1,69 +1,69 @@
1
- ---
2
- name: lucid-context
3
- description: Use BEFORE starting any coding task — retrieves relevant context via smart_context (code + knowledge graph). HARD-GATE: do not read files manually before calling smart_context.
4
- argument-hint: "[what you are working on]"
5
- ---
6
-
7
- <HARD-GATE>
8
- Do NOT open any source file, read any code, or start implementation
9
- until you have called smart_context and reviewed the result.
10
- Reading files manually when Lucid is available wastes tokens and misses context.
11
- </HARD-GATE>
12
-
13
- ## When to invoke this skill
14
-
15
- **INVOKE when:** about to work on a feature, fix a bug, understand a module, or any coding task
16
- **DO NOT INVOKE for:** pure conversation, reading docs, non-code questions
17
-
18
- ## Steps
19
-
20
- ```dot
21
- digraph lucid_context {
22
- "Describe task" -> "suggest_model";
23
- "suggest_model" -> "call smart_context";
24
- "call smart_context" -> "Result relevant?";
25
- "Result relevant?" -> "call reward()" [label="yes"];
26
- "Result relevant?" -> "call penalize()" [label="no — note what was missing"];
27
- "reward()" -> "Start coding";
28
- "penalize()" -> "Start coding";
29
- }
30
- ```
31
-
32
- ### 0. Get model recommendation
33
- ```
34
- suggest_model(task_description="<concise description of what you are working on>")
35
- ```
36
- Say: **"Using [model] — [reasoning]"**
37
-
38
- ### 1. Call smart_context
39
- ```
40
- smart_context(query="<concise description of what you are working on>", task_type="moderate")
41
- ```
42
-
43
- Use `dirs` to narrow scope and `task_type` to adjust budget:
44
- ```
45
- smart_context(query="...", dirs=["src/api"], task_type="simple")
46
- ```
47
-
48
- ### 2. Review results and give feedback
49
-
50
- | Result quality | Action |
51
- |---|---|
52
- | Included the files you needed | `reward()` |
53
- | Missed important files you had to find manually | `penalize(note="missed: src/path/file.ts")` |
54
- | Partially useful | no action |
55
-
56
- ### 3. Supplement if needed
57
-
58
- ```
59
- grep_code(pattern="functionName") # locate specific usages
60
- get_recent(hours=2) # after git pull — see what changed
61
- recall(query="<topic>") # search accumulated knowledge
62
- ```
63
-
64
- ### 4. After finishing — sync
65
-
66
- After every Write/Edit:
67
- ```
68
- sync_file(path="<modified file>")
69
- ```
1
+ ---
2
+ name: lucid-context
3
+ description: Use BEFORE starting any coding task — retrieves relevant context via smart_context (code + knowledge graph). HARD-GATE: do not read files manually before calling smart_context.
4
+ argument-hint: "[what you are working on]"
5
+ ---
6
+
7
+ <HARD-GATE>
8
+ Do NOT open any source file, read any code, or start implementation
9
+ until you have called smart_context and reviewed the result.
10
+ Reading files manually when Lucid is available wastes tokens and misses context.
11
+ </HARD-GATE>
12
+
13
+ ## When to invoke this skill
14
+
15
+ **INVOKE when:** about to work on a feature, fix a bug, understand a module, or any coding task
16
+ **DO NOT INVOKE for:** pure conversation, reading docs, non-code questions
17
+
18
+ ## Steps
19
+
20
+ ```dot
21
+ digraph lucid_context {
22
+ "Describe task" -> "suggest_model";
23
+ "suggest_model" -> "call smart_context";
24
+ "call smart_context" -> "Result relevant?";
25
+ "Result relevant?" -> "call reward()" [label="yes"];
26
+ "Result relevant?" -> "call penalize()" [label="no — note what was missing"];
27
+ "reward()" -> "Start coding";
28
+ "penalize()" -> "Start coding";
29
+ }
30
+ ```
31
+
32
+ ### 0. Get model recommendation
33
+ ```
34
+ suggest_model(task_description="<concise description of what you are working on>")
35
+ ```
36
+ Say: **"Using [model] — [reasoning]"**
37
+
38
+ ### 1. Call smart_context
39
+ ```
40
+ smart_context(query="<concise description of what you are working on>", task_type="moderate")
41
+ ```
42
+
43
+ Use `dirs` to narrow scope and `task_type` to adjust budget:
44
+ ```
45
+ smart_context(query="...", dirs=["src/api"], task_type="simple")
46
+ ```
47
+
48
+ ### 2. Review results and give feedback
49
+
50
+ | Result quality | Action |
51
+ |---|---|
52
+ | Included the files you needed | `reward()` |
53
+ | Missed important files you had to find manually | `penalize(note="missed: src/path/file.ts")` |
54
+ | Partially useful | no action |
55
+
56
+ ### 3. Supplement if needed
57
+
58
+ ```
59
+ grep_code(pattern="functionName") # locate specific usages
60
+ get_recent(hours=2) # after git pull — see what changed
61
+ recall(query="<topic>") # search accumulated knowledge
62
+ ```
63
+
64
+ ### 4. After finishing — sync
65
+
66
+ After every Write/Edit:
67
+ ```
68
+ sync_file(path="<modified file>")
69
+ ```
@@ -1,52 +1,52 @@
1
- ---
2
- name: lucid-plan
3
- description: MANDATORY before writing code for any non-trivial feature — creates a persisted plan with tasks. HARD-GATE: no coding without a plan.
4
- argument-hint: "[feature or task description]"
5
- ---
6
-
7
- <HARD-GATE>
8
- You are about to write code for a feature or fix.
9
- STOP. Create a plan first. Plans survive session restarts.
10
- Do NOT write implementation code until a plan exists and tasks are defined.
11
- </HARD-GATE>
12
-
13
- ## When to invoke
14
-
15
- **INVOKE when:** implementing a feature, fixing a non-trivial bug, any task with 3+ steps
16
- **DO NOT INVOKE for:** single-line fixes, config changes, documentation-only tasks
17
-
18
- ## Steps
19
-
20
- ### 0. Get model recommendation
21
- ```
22
- suggest_model(task_description="<paste the user's task description>")
23
- ```
24
- Say: **"Using [model] — [reasoning]"** then proceed.
25
-
26
- ### 1. Create the plan
27
- ```
28
- plan_create(
29
- title="<short descriptive title>",
30
- description="<what this accomplishes>",
31
- user_story="As a <user>, I want <goal>, so that <benefit>.",
32
- tasks=[
33
- { title: "Task 1", description: "...", test_criteria: "How to verify it's done" },
34
- { title: "Task 2", description: "...", test_criteria: "..." },
35
- ]
36
- )
37
- ```
38
- Returns a `plan_id` and task IDs (format: `planId * 100 + sequence`).
39
-
40
- ### 2. Mark tasks in progress / done as you work
41
- ```
42
- plan_update_task(task_id=101, status="in_progress")
43
- plan_update_task(task_id=101, status="done", note="Decision made: used X instead of Y")
44
- ```
45
-
46
- ### 3. Resume a session
47
- ```
48
- plan_list() # all active plans
49
- plan_get(plan_id=1) # full details + task status
50
- ```
51
-
52
- ## Task statuses: `pending` → `in_progress` → `done` | `blocked`
1
+ ---
2
+ name: lucid-plan
3
+ description: MANDATORY before writing code for any non-trivial feature — creates a persisted plan with tasks. HARD-GATE: no coding without a plan.
4
+ argument-hint: "[feature or task description]"
5
+ ---
6
+
7
+ <HARD-GATE>
8
+ You are about to write code for a feature or fix.
9
+ STOP. Create a plan first. Plans survive session restarts.
10
+ Do NOT write implementation code until a plan exists and tasks are defined.
11
+ </HARD-GATE>
12
+
13
+ ## When to invoke
14
+
15
+ **INVOKE when:** implementing a feature, fixing a non-trivial bug, any task with 3+ steps
16
+ **DO NOT INVOKE for:** single-line fixes, config changes, documentation-only tasks
17
+
18
+ ## Steps
19
+
20
+ ### 0. Get model recommendation
21
+ ```
22
+ suggest_model(task_description="<paste the user's task description>")
23
+ ```
24
+ Say: **"Using [model] — [reasoning]"** then proceed.
25
+
26
+ ### 1. Create the plan
27
+ ```
28
+ plan_create(
29
+ title="<short descriptive title>",
30
+ description="<what this accomplishes>",
31
+ user_story="As a <user>, I want <goal>, so that <benefit>.",
32
+ tasks=[
33
+ { title: "Task 1", description: "...", test_criteria: "How to verify it's done" },
34
+ { title: "Task 2", description: "...", test_criteria: "..." },
35
+ ]
36
+ )
37
+ ```
38
+ Returns a `plan_id` and task IDs (format: `planId * 100 + sequence`).
39
+
40
+ ### 2. Mark tasks in progress / done as you work
41
+ ```
42
+ plan_update_task(task_id=101, status="in_progress")
43
+ plan_update_task(task_id=101, status="done", note="Decision made: used X instead of Y")
44
+ ```
45
+
46
+ ### 3. Resume a session
47
+ ```
48
+ plan_list() # all active plans
49
+ plan_get(plan_id=1) # full details + task status
50
+ ```
51
+
52
+ ## Task statuses: `pending` → `in_progress` → `done` | `blocked`
@@ -1,41 +1,41 @@
1
- ---
2
- name: lucid-security
3
- description: Run before merging any code that handles user input, auth, or external data — security scan + drift check for injection, XSS, and credential exposure.
4
- argument-hint: "[file path or directory]"
5
- ---
6
-
7
- <HARD-GATE>
8
- Before merging code that:
9
- - Handles user input (forms, query params, file uploads)
10
- - Implements auth, tokens, sessions, or permissions
11
- - Calls external APIs or parses external data
12
- - Manages files or runs shell commands
13
-
14
- Run this skill. No exceptions.
15
- </HARD-GATE>
16
-
17
- ## Steps
18
-
19
- ### 0. Get model recommendation
20
- ```
21
- suggest_model(task_description="<paste the user's task description>")
22
- ```
23
- Say: **"Using [model] — [reasoning]"** then proceed.
24
-
25
- ### 1. Security scan
26
- ```
27
- security_scan(code="<file contents or snippet>", language="typescript", context="backend")
28
- ```
29
-
30
- ### 2. Drift check for security-sensitive snippets
31
- ```
32
- check_drift(code="<auth/input-handling code>", language="typescript")
33
- ```
34
-
35
- ### 3. Fix all CRITICAL issues before merging
36
-
37
- | Severity | Action |
38
- |---|---|
39
- | 🔴 CRITICAL | Block merge — fix immediately |
40
- | 🟠 HIGH | Fix before merge |
41
- | 🔵 MEDIUM/LOW | Track, fix in follow-up |
1
+ ---
2
+ name: lucid-security
3
+ description: Run before merging any code that handles user input, auth, or external data — security scan + drift check for injection, XSS, and credential exposure.
4
+ argument-hint: "[file path or directory]"
5
+ ---
6
+
7
+ <HARD-GATE>
8
+ Before merging code that:
9
+ - Handles user input (forms, query params, file uploads)
10
+ - Implements auth, tokens, sessions, or permissions
11
+ - Calls external APIs or parses external data
12
+ - Manages files or runs shell commands
13
+
14
+ Run this skill. No exceptions.
15
+ </HARD-GATE>
16
+
17
+ ## Steps
18
+
19
+ ### 0. Get model recommendation
20
+ ```
21
+ suggest_model(task_description="<paste the user's task description>")
22
+ ```
23
+ Say: **"Using [model] — [reasoning]"** then proceed.
24
+
25
+ ### 1. Security scan
26
+ ```
27
+ security_scan(code="<file contents or snippet>", language="typescript", context="backend")
28
+ ```
29
+
30
+ ### 2. Drift check for security-sensitive snippets
31
+ ```
32
+ check_drift(code="<auth/input-handling code>", language="typescript")
33
+ ```
34
+
35
+ ### 3. Fix all CRITICAL issues before merging
36
+
37
+ | Severity | Action |
38
+ |---|---|
39
+ | 🔴 CRITICAL | Block merge — fix immediately |
40
+ | 🟠 HIGH | Fix before merge |
41
+ | 🔵 MEDIUM/LOW | Track, fix in follow-up |
@@ -1,70 +1,70 @@
1
- ---
2
- name: lucid-start
3
- description: MANDATORY at every session start and before any coding task — loads project context via Lucid before Claude reads any file or writes any code
4
- argument-hint: "[optional: what you are about to work on]"
5
- ---
6
-
7
- <HARD-GATE>
8
- You MUST complete ALL steps below BEFORE:
9
- - Reading any source file
10
- - Writing or editing any code
11
- - Answering any coding question
12
- - Creating any plan or task
13
-
14
- This is not optional. There are no exceptions. "I'll do it after" is not acceptable.
15
- </HARD-GATE>
16
-
17
- ## Steps (all mandatory, in order)
18
-
19
- ### 0. Get model recommendation
20
- ```
21
- suggest_model(task_description="<paste the user's task description>")
22
- ```
23
- Say: **"Using [model] — [reasoning]"** then proceed.
24
-
25
- ### 1. Check what changed recently
26
- ```
27
- get_recent(hours=48)
28
- ```
29
- This shows files modified since your last session. Review the list.
30
-
31
- ### 2. If working on a specific task — load relevant context
32
- ```
33
- smart_context(query="<describe what you are about to work on>", task_type="moderate")
34
- ```
35
- If the user's request involves code, call smart_context. For purely conversational exchanges with zero code involvement, this step may be omitted.
36
-
37
- ### 3. Announce readiness
38
- Say: "✓ Lucid active — context loaded"
39
-
40
- ---
41
-
42
- ## After EVERY file write or edit
43
-
44
- Call `sync_file` IMMEDIATELY after the tool call completes:
45
- ```
46
- sync_file(path="<exact path of file you just wrote or edited>")
47
- ```
48
-
49
- **Do this before anything else.** Before the next file. Before the next thought. Now.
50
-
51
- If you modified multiple files (refactor, git pull): call `sync_project()` instead.
52
-
53
- ---
54
-
55
- ## Before marking any task as done
56
-
57
- Run /lucid-audit before saying "done", "fixed", "complete", or "implemented".
58
-
59
- ---
60
-
61
- ## Trigger conditions
62
-
63
- **USE this skill:**
64
- - At the start of every new conversation
65
- - When resuming work after a break
66
- - When the user says "let's work on X" or similar
67
-
68
- **DO NOT USE for:**
69
- - Pure conversation with no code involved
70
- - Answering theoretical questions
1
+ ---
2
+ name: lucid-start
3
+ description: MANDATORY at every session start and before any coding task — loads project context via Lucid before Claude reads any file or writes any code
4
+ argument-hint: "[optional: what you are about to work on]"
5
+ ---
6
+
7
+ <HARD-GATE>
8
+ You MUST complete ALL steps below BEFORE:
9
+ - Reading any source file
10
+ - Writing or editing any code
11
+ - Answering any coding question
12
+ - Creating any plan or task
13
+
14
+ This is not optional. There are no exceptions. "I'll do it after" is not acceptable.
15
+ </HARD-GATE>
16
+
17
+ ## Steps (all mandatory, in order)
18
+
19
+ ### 0. Get model recommendation
20
+ ```
21
+ suggest_model(task_description="<paste the user's task description>")
22
+ ```
23
+ Say: **"Using [model] — [reasoning]"** then proceed.
24
+
25
+ ### 1. Check what changed recently
26
+ ```
27
+ get_recent(hours=48)
28
+ ```
29
+ This shows files modified since your last session. Review the list.
30
+
31
+ ### 2. If working on a specific task — load relevant context
32
+ ```
33
+ smart_context(query="<describe what you are about to work on>", task_type="moderate")
34
+ ```
35
+ If the user's request involves code, call smart_context. For purely conversational exchanges with zero code involvement, this step may be omitted.
36
+
37
+ ### 3. Announce readiness
38
+ Say: "✓ Lucid active — context loaded"
39
+
40
+ ---
41
+
42
+ ## After EVERY file write or edit
43
+
44
+ Call `sync_file` IMMEDIATELY after the tool call completes:
45
+ ```
46
+ sync_file(path="<exact path of file you just wrote or edited>")
47
+ ```
48
+
49
+ **Do this before anything else.** Before the next file. Before the next thought. Now.
50
+
51
+ If you modified multiple files (refactor, git pull): call `sync_project()` instead.
52
+
53
+ ---
54
+
55
+ ## Before marking any task as done
56
+
57
+ Run /lucid-audit before saying "done", "fixed", "complete", or "implemented".
58
+
59
+ ---
60
+
61
+ ## Trigger conditions
62
+
63
+ **USE this skill:**
64
+ - At the start of every new conversation
65
+ - When resuming work after a break
66
+ - When the user says "let's work on X" or similar
67
+
68
+ **DO NOT USE for:**
69
+ - Pure conversation with no code involved
70
+ - Answering theoretical questions
@@ -1,45 +1,45 @@
1
- ---
2
- name: lucid-webdev
3
- description: Use for web development tasks — generates components, pages, audits, API clients, and performance hints via Lucid's 10 web dev tools.
4
- argument-hint: "[what you are building: component/page/api/audit]"
5
- ---
6
-
7
- <HARD-GATE>
8
- Before building any web component, page, or API client from scratch:
9
- call the relevant generator tool first. Do not write boilerplate manually.
10
- </HARD-GATE>
11
-
12
- ## When to invoke
13
-
14
- **INVOKE when:** building UI components, scaffolding pages, writing API clients, running accessibility/security/performance audits
15
- **DO NOT INVOKE for:** backend-only logic with no web layer
16
-
17
- ## Steps
18
-
19
- ### 0. Get model recommendation
20
- ```
21
- suggest_model(task_description="<paste the user's task description>")
22
- ```
23
- Say: **"Using [model] — [reasoning]"** then proceed.
24
-
25
- ## Available tools
26
-
27
- | Task | Tool |
28
- |---|---|
29
- | Generate a React/Vue component | `generate_component(description, framework, styling, typescript)` |
30
- | Scaffold a full page | `scaffold_page(page_name, framework, sections, seo_title)` |
31
- | SEO meta tags | `seo_meta(title, description, keywords, page_type, url, image_url)` |
32
- | Accessibility audit | `accessibility_audit(code, wcag_level, framework)` |
33
- | API client | `api_client(endpoint, method, response_schema, auth, base_url_var)` |
34
- | Test scaffolding | `test_generator(code, test_framework, test_type, component_framework)` |
35
- | Responsive layout | `responsive_layout(description, framework, breakpoints, container)` |
36
- | Security scan | `security_scan(code, language, context)` |
37
- | Design tokens | `design_tokens(brand_name, primary_color, mood, output_format)` |
38
- | Performance hints | `perf_hints(code, framework, context)` |
39
-
40
- ## Workflow
41
-
42
- 1. Call the relevant generator/auditor tool
43
- 2. Review output → adapt to project conventions
44
- 3. `sync_file(path="<generated file>")` after saving
45
- 4. Run /lucid-audit before marking done
1
+ ---
2
+ name: lucid-webdev
3
+ description: Use for web development tasks — generates components, pages, audits, API clients, and performance hints via Lucid's 10 web dev tools.
4
+ argument-hint: "[what you are building: component/page/api/audit]"
5
+ ---
6
+
7
+ <HARD-GATE>
8
+ Before building any web component, page, or API client from scratch:
9
+ call the relevant generator tool first. Do not write boilerplate manually.
10
+ </HARD-GATE>
11
+
12
+ ## When to invoke
13
+
14
+ **INVOKE when:** building UI components, scaffolding pages, writing API clients, running accessibility/security/performance audits
15
+ **DO NOT INVOKE for:** backend-only logic with no web layer
16
+
17
+ ## Steps
18
+
19
+ ### 0. Get model recommendation
20
+ ```
21
+ suggest_model(task_description="<paste the user's task description>")
22
+ ```
23
+ Say: **"Using [model] — [reasoning]"** then proceed.
24
+
25
+ ## Available tools
26
+
27
+ | Task | Tool |
28
+ |---|---|
29
+ | Generate a React/Vue component | `generate_component(description, framework, styling, typescript)` |
30
+ | Scaffold a full page | `scaffold_page(page_name, framework, sections, seo_title)` |
31
+ | SEO meta tags | `seo_meta(title, description, keywords, page_type, url, image_url)` |
32
+ | Accessibility audit | `accessibility_audit(code, wcag_level, framework)` |
33
+ | API client | `api_client(endpoint, method, response_schema, auth, base_url_var)` |
34
+ | Test scaffolding | `test_generator(code, test_framework, test_type, component_framework)` |
35
+ | Responsive layout | `responsive_layout(description, framework, breakpoints, container)` |
36
+ | Security scan | `security_scan(code, language, context)` |
37
+ | Design tokens | `design_tokens(brand_name, primary_color, mood, output_format)` |
38
+ | Performance hints | `perf_hints(code, framework, context)` |
39
+
40
+ ## Workflow
41
+
42
+ 1. Call the relevant generator/auditor tool
43
+ 2. Review output → adapt to project conventions
44
+ 3. `sync_file(path="<generated file>")` after saving
45
+ 4. Run /lucid-audit before marking done