@a13xu/lucid 1.16.0 → 1.16.2

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.
@@ -16,10 +16,10 @@ export const PlanListSchema = z.object({
16
16
  status: z.enum(["active", "completed", "abandoned", "all"]).optional().default("active"),
17
17
  });
18
18
  export const PlanGetSchema = z.object({
19
- plan_id: z.number().int().positive(),
19
+ plan_id: z.coerce.number().int().positive(),
20
20
  });
21
21
  export const PlanUpdateTaskSchema = z.object({
22
- task_id: z.number().int().positive(),
22
+ task_id: z.coerce.number().int().positive(),
23
23
  status: z.enum(["pending", "in_progress", "done", "blocked"]),
24
24
  note: z.string().optional(),
25
25
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@a13xu/lucid",
3
- "version": "1.16.0",
3
+ "version": "1.16.2",
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": {
@@ -15,6 +15,7 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "build": "tsc",
18
+ "compress-prompts": "node scripts/compress-prompts.mjs",
18
19
  "prepublishOnly": "npm run build"
19
20
  },
20
21
  "keywords": [
@@ -53,6 +54,7 @@
53
54
  "better-sqlite3": "^12.0.0",
54
55
  "chokidar": "^4.0.3",
55
56
  "express": "^5.2.1",
57
+ "sharp": "^0.34.5",
56
58
  "zod": "^3.23.8"
57
59
  },
58
60
  "devDependencies": {
@@ -1,73 +1,84 @@
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
+ allowed-tools:
6
+ - mcp__lucid__suggest_model
7
+ - mcp__lucid__validate_file
8
+ - mcp__lucid__check_drift
9
+ - mcp__lucid__get_checklist
10
+ - mcp__lucid__check_code_quality
11
+ - mcp__lucid__coding_rules
12
+ - mcp__lucid__get_recent
13
+ - mcp__lucid__sync_file
14
+ - Read
15
+ - Glob
16
+ ---
17
+
18
+ <HARD-GATE>
19
+ You are about to say "done", "fixed", "complete", or "implemented".
20
+ STOP. You have NOT verified the code yet.
21
+
22
+ Do NOT mark any task as done, do NOT commit, do NOT say the work is complete
23
+ until you have run BOTH validators below and fixed all 🔴 CRITICAL issues.
24
+
25
+ "It looks correct" is not verification. Run the tools.
26
+ </HARD-GATE>
27
+
28
+ ## When to invoke
29
+
30
+ **INVOKE when:** about to say done/fixed/complete/implemented, before committing, before creating a PR
31
+ **DO NOT INVOKE for:** read-only tasks, pure research, config changes with no logic
32
+
33
+ ## Steps
34
+
35
+ ```dot
36
+ digraph lucid_audit {
37
+ "About to say done?" -> "validate_file(path)";
38
+ "validate_file(path)" -> "Critical issues?";
39
+ "Critical issues?" -> "Fix issues" [label="yes 🔴"];
40
+ "Fix issues" -> "validate_file(path)";
41
+ "Critical issues?" -> "check_code_quality(path)" [label="no ✓"];
42
+ "check_code_quality(path)" -> "HIGH issues?";
43
+ "HIGH issues?" -> "Fix if safe" [label="yes 🟠"];
44
+ "Fix if safe" -> "Mark done ✓";
45
+ "HIGH issues?" -> "Mark done ✓" [label="no ✓"];
46
+ }
47
+ ```
48
+
49
+ ### 0. Get model recommendation
50
+ ```
51
+ suggest_model(task_description="<paste the file path or description of what was written>")
52
+ ```
53
+ Say: **"Using [model] — [reasoning]"** then proceed.
54
+
55
+ ### 1. Validate logic correctness
56
+ ```
57
+ validate_file(path="<file you wrote or modified>")
58
+ ```
59
+ Fix every 🔴 CRITICAL issue. Re-run until clean.
60
+
61
+ ### 2. Validate code quality
62
+ ```
63
+ check_code_quality(path="<same file>")
64
+ ```
65
+ Fix 🔴 HIGH severity issues. Address 🟠 MEDIUM where practical.
66
+
67
+ ### 3. For complex logic — get the full checklist
68
+ ```
69
+ get_checklist()
70
+ ```
71
+ Run all 5 mental passes before marking done.
72
+
73
+ ### 4. Pre-write validation (before writing to disk)
74
+ ```
75
+ check_drift(code="<your code snippet>", language="typescript")
76
+ ```
77
+
78
+ ## Severity guide
79
+
80
+ | Icon | Level | Action |
81
+ |---|---|---|
82
+ | 🔴 | Critical/High | Fix immediately — do not proceed |
83
+ | 🟠 | Medium | Fix if the refactor is safe |
84
+ | 🔵 | Low/Info | Note for future cleanup |
@@ -1,69 +1,78 @@
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
+ allowed-tools:
6
+ - mcp__lucid__suggest_model
7
+ - mcp__lucid__smart_context
8
+ - mcp__lucid__get_context
9
+ - mcp__lucid__get_recent
10
+ - mcp__lucid__recall
11
+ - mcp__lucid__grep_code
12
+ - mcp__lucid__reward
13
+ - mcp__lucid__penalize
14
+ ---
15
+
16
+ <HARD-GATE>
17
+ Do NOT open any source file, read any code, or start implementation
18
+ until you have called smart_context and reviewed the result.
19
+ Reading files manually when Lucid is available wastes tokens and misses context.
20
+ </HARD-GATE>
21
+
22
+ ## When to invoke this skill
23
+
24
+ **INVOKE when:** about to work on a feature, fix a bug, understand a module, or any coding task
25
+ **DO NOT INVOKE for:** pure conversation, reading docs, non-code questions
26
+
27
+ ## Steps
28
+
29
+ ```dot
30
+ digraph lucid_context {
31
+ "Describe task" -> "suggest_model";
32
+ "suggest_model" -> "call smart_context";
33
+ "call smart_context" -> "Result relevant?";
34
+ "Result relevant?" -> "call reward()" [label="yes"];
35
+ "Result relevant?" -> "call penalize()" [label="no — note what was missing"];
36
+ "reward()" -> "Start coding";
37
+ "penalize()" -> "Start coding";
38
+ }
39
+ ```
40
+
41
+ ### 0. Get model recommendation
42
+ ```
43
+ suggest_model(task_description="<concise description of what you are working on>")
44
+ ```
45
+ Say: **"Using [model] — [reasoning]"**
46
+
47
+ ### 1. Call smart_context
48
+ ```
49
+ smart_context(query="<concise description of what you are working on>", task_type="moderate")
50
+ ```
51
+
52
+ Use `dirs` to narrow scope and `task_type` to adjust budget:
53
+ ```
54
+ smart_context(query="...", dirs=["src/api"], task_type="simple")
55
+ ```
56
+
57
+ ### 2. Review results and give feedback
58
+
59
+ | Result quality | Action |
60
+ |---|---|
61
+ | Included the files you needed | `reward()` |
62
+ | Missed important files you had to find manually | `penalize(note="missed: src/path/file.ts")` |
63
+ | Partially useful | no action |
64
+
65
+ ### 3. Supplement if needed
66
+
67
+ ```
68
+ grep_code(pattern="functionName") # locate specific usages
69
+ get_recent(hours=2) # after git pull — see what changed
70
+ recall(query="<topic>") # search accumulated knowledge
71
+ ```
72
+
73
+ ### 4. After finishing — sync
74
+
75
+ After every Write/Edit:
76
+ ```
77
+ sync_file(path="<modified file>")
78
+ ```
@@ -1,52 +1,61 @@
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
+ allowed-tools:
6
+ - mcp__lucid__suggest_model
7
+ - mcp__lucid__plan_create
8
+ - mcp__lucid__plan_list
9
+ - mcp__lucid__plan_get
10
+ - mcp__lucid__plan_update_task
11
+ - mcp__lucid__smart_context
12
+ - mcp__lucid__recall
13
+ - mcp__lucid__remember
14
+ ---
15
+
16
+ <HARD-GATE>
17
+ You are about to write code for a feature or fix.
18
+ STOP. Create a plan first. Plans survive session restarts.
19
+ Do NOT write implementation code until a plan exists and tasks are defined.
20
+ </HARD-GATE>
21
+
22
+ ## When to invoke
23
+
24
+ **INVOKE when:** implementing a feature, fixing a non-trivial bug, any task with 3+ steps
25
+ **DO NOT INVOKE for:** single-line fixes, config changes, documentation-only tasks
26
+
27
+ ## Steps
28
+
29
+ ### 0. Get model recommendation
30
+ ```
31
+ suggest_model(task_description="<paste the user's task description>")
32
+ ```
33
+ Say: **"Using [model] [reasoning]"** then proceed.
34
+
35
+ ### 1. Create the plan
36
+ ```
37
+ plan_create(
38
+ title="<short descriptive title>",
39
+ description="<what this accomplishes>",
40
+ user_story="As a <user>, I want <goal>, so that <benefit>.",
41
+ tasks=[
42
+ { title: "Task 1", description: "...", test_criteria: "How to verify it's done" },
43
+ { title: "Task 2", description: "...", test_criteria: "..." },
44
+ ]
45
+ )
46
+ ```
47
+ Returns a `plan_id` and task IDs (format: `planId * 100 + sequence`).
48
+
49
+ ### 2. Mark tasks in progress / done as you work
50
+ ```
51
+ plan_update_task(task_id=101, status="in_progress")
52
+ plan_update_task(task_id=101, status="done", note="Decision made: used X instead of Y")
53
+ ```
54
+
55
+ ### 3. Resume a session
56
+ ```
57
+ plan_list() # all active plans
58
+ plan_get(plan_id=1) # full details + task status
59
+ ```
60
+
61
+ ## Task statuses: `pending` → `in_progress` → `done` | `blocked`
@@ -1,41 +1,50 @@
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
+ allowed-tools:
6
+ - mcp__lucid__suggest_model
7
+ - mcp__lucid__security_scan
8
+ - mcp__lucid__check_drift
9
+ - mcp__lucid__validate_file
10
+ - mcp__lucid__get_recent
11
+ - mcp__lucid__grep_code
12
+ - Read
13
+ - Glob
14
+ ---
15
+
16
+ <HARD-GATE>
17
+ Before merging code that:
18
+ - Handles user input (forms, query params, file uploads)
19
+ - Implements auth, tokens, sessions, or permissions
20
+ - Calls external APIs or parses external data
21
+ - Manages files or runs shell commands
22
+
23
+ Run this skill. No exceptions.
24
+ </HARD-GATE>
25
+
26
+ ## Steps
27
+
28
+ ### 0. Get model recommendation
29
+ ```
30
+ suggest_model(task_description="<paste the user's task description>")
31
+ ```
32
+ Say: **"Using [model] — [reasoning]"** then proceed.
33
+
34
+ ### 1. Security scan
35
+ ```
36
+ security_scan(code="<file contents or snippet>", language="typescript", context="backend")
37
+ ```
38
+
39
+ ### 2. Drift check for security-sensitive snippets
40
+ ```
41
+ check_drift(code="<auth/input-handling code>", language="typescript")
42
+ ```
43
+
44
+ ### 3. Fix all CRITICAL issues before merging
45
+
46
+ | Severity | Action |
47
+ |---|---|
48
+ | 🔴 CRITICAL | Block merge — fix immediately |
49
+ | 🟠 HIGH | Fix before merge |
50
+ | 🔵 MEDIUM/LOW | Track, fix in follow-up |