vibelearn 0.1.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.
Files changed (57) hide show
  1. package/LICENSE +630 -0
  2. package/README.md +287 -0
  3. package/package.json +129 -0
  4. package/plugin/.claude-plugin/CLAUDE.md +4 -0
  5. package/plugin/.claude-plugin/plugin.json +23 -0
  6. package/plugin/.cli-installed +1 -0
  7. package/plugin/CLAUDE.md +6 -0
  8. package/plugin/hooks/CLAUDE.md +6 -0
  9. package/plugin/hooks/bugfixes-2026-01-10.md +92 -0
  10. package/plugin/hooks/hooks.json +79 -0
  11. package/plugin/modes/code--ar.json +24 -0
  12. package/plugin/modes/code--bn.json +24 -0
  13. package/plugin/modes/code--chill.json +8 -0
  14. package/plugin/modes/code--cs.json +24 -0
  15. package/plugin/modes/code--da.json +24 -0
  16. package/plugin/modes/code--de.json +24 -0
  17. package/plugin/modes/code--el.json +24 -0
  18. package/plugin/modes/code--es.json +24 -0
  19. package/plugin/modes/code--fi.json +24 -0
  20. package/plugin/modes/code--fr.json +24 -0
  21. package/plugin/modes/code--he.json +24 -0
  22. package/plugin/modes/code--hi.json +24 -0
  23. package/plugin/modes/code--hu.json +24 -0
  24. package/plugin/modes/code--id.json +24 -0
  25. package/plugin/modes/code--it.json +24 -0
  26. package/plugin/modes/code--ja.json +24 -0
  27. package/plugin/modes/code--ko.json +24 -0
  28. package/plugin/modes/code--nl.json +24 -0
  29. package/plugin/modes/code--no.json +24 -0
  30. package/plugin/modes/code--pl.json +24 -0
  31. package/plugin/modes/code--pt-br.json +24 -0
  32. package/plugin/modes/code--ro.json +24 -0
  33. package/plugin/modes/code--ru.json +24 -0
  34. package/plugin/modes/code--sv.json +24 -0
  35. package/plugin/modes/code--th.json +24 -0
  36. package/plugin/modes/code--tr.json +24 -0
  37. package/plugin/modes/code--uk.json +24 -0
  38. package/plugin/modes/code--ur.json +25 -0
  39. package/plugin/modes/code--vi.json +24 -0
  40. package/plugin/modes/code--zh.json +24 -0
  41. package/plugin/modes/code.json +125 -0
  42. package/plugin/modes/email-investigation.json +120 -0
  43. package/plugin/modes/law-study--chill.json +7 -0
  44. package/plugin/modes/law-study-CLAUDE.md +85 -0
  45. package/plugin/modes/law-study.json +120 -0
  46. package/plugin/package.json +23 -0
  47. package/plugin/scripts/CLAUDE.md +5 -0
  48. package/plugin/scripts/bun-runner.js +176 -0
  49. package/plugin/scripts/mcp-server.cjs +141 -0
  50. package/plugin/scripts/smart-install.js +592 -0
  51. package/plugin/scripts/statusline-counts.js +61 -0
  52. package/plugin/scripts/vl-cli.cjs +104 -0
  53. package/plugin/scripts/worker-cli.js +19 -0
  54. package/plugin/scripts/worker-service.cjs +1919 -0
  55. package/plugin/scripts/worker-wrapper.cjs +2 -0
  56. package/plugin/skills/smart-explore/SKILL.md +145 -0
  57. package/plugin/skills/timeline-report/SKILL.md +91 -0
@@ -0,0 +1,120 @@
1
+ {
2
+ "name": "Law Study",
3
+ "description": "Legal study and exam preparation for law students",
4
+ "version": "1.0.0",
5
+ "observation_types": [
6
+ {
7
+ "id": "case-holding",
8
+ "label": "Case Holding",
9
+ "description": "Case brief (2-3 sentences: key facts + holding) with extracted legal rule",
10
+ "emoji": "⚖️",
11
+ "work_emoji": "📖"
12
+ },
13
+ {
14
+ "id": "issue-pattern",
15
+ "label": "Issue Pattern",
16
+ "description": "Exam trigger or fact pattern that signals a legal issue to spot",
17
+ "emoji": "🎯",
18
+ "work_emoji": "🔍"
19
+ },
20
+ {
21
+ "id": "prof-framework",
22
+ "label": "Prof Framework",
23
+ "description": "Professor's analytical lens, emphasis, or approach to a topic or doctrine",
24
+ "emoji": "🧑‍🏫",
25
+ "work_emoji": "📝"
26
+ },
27
+ {
28
+ "id": "doctrine-rule",
29
+ "label": "Doctrine / Rule",
30
+ "description": "Legal test, standard, or doctrine synthesized from cases, statutes, or restatements",
31
+ "emoji": "📜",
32
+ "work_emoji": "🔍"
33
+ },
34
+ {
35
+ "id": "argument-structure",
36
+ "label": "Argument Structure",
37
+ "description": "Legal argument or counter-argument worked through with analytical steps",
38
+ "emoji": "🗣️",
39
+ "work_emoji": "⚖️"
40
+ },
41
+ {
42
+ "id": "cross-case-connection",
43
+ "label": "Cross-Case Connection",
44
+ "description": "Insight linking multiple cases, doctrines, or topics that reveals a deeper principle",
45
+ "emoji": "🔗",
46
+ "work_emoji": "🔍"
47
+ }
48
+ ],
49
+ "observation_concepts": [
50
+ {
51
+ "id": "exam-relevant",
52
+ "label": "Exam Relevant",
53
+ "description": "Flagged by professor or likely to appear on exams based on emphasis"
54
+ },
55
+ {
56
+ "id": "minority-position",
57
+ "label": "Minority Position",
58
+ "description": "Dissent, minority rule, or alternative jurisdictional approach worth knowing"
59
+ },
60
+ {
61
+ "id": "gotcha",
62
+ "label": "Gotcha",
63
+ "description": "Subtle nuance, counterintuitive result, or common mistake students get wrong"
64
+ },
65
+ {
66
+ "id": "unsettled-law",
67
+ "label": "Unsettled Law",
68
+ "description": "Circuit split, open question, or evolving area of law"
69
+ },
70
+ {
71
+ "id": "policy-rationale",
72
+ "label": "Policy Rationale",
73
+ "description": "Normative or policy argument underlying a rule or holding"
74
+ },
75
+ {
76
+ "id": "course-theme",
77
+ "label": "Course Theme",
78
+ "description": "How this case or rule connects to the overarching narrative or theory of the course"
79
+ }
80
+ ],
81
+ "prompts": {
82
+ "system_identity": "You are VibeLearn, a specialized observer tool for creating searchable memory FOR FUTURE SESSIONS.\n\nCRITICAL: Record what was READ, ANALYZED, SYNTHESIZED, or LEARNED about the law, not what you (the observer) are doing.\n\nYou do not have access to tools. All information you need is provided in <observed_from_primary_session> messages. Create observations from what you observe - no investigation needed.",
83
+ "spatial_awareness": "SPATIAL AWARENESS: Tool executions include the working directory (tool_cwd) to help you understand:\n- Which repository/project is being worked on\n- Where files are located relative to the project root\n- How to match requested paths to actual execution paths",
84
+ "observer_role": "Your job is to monitor a different Claude Code session happening RIGHT NOW, with the goal of creating observations and progress summaries as legal study is being done LIVE by the user. You are NOT the one doing the work - you are ONLY observing and recording what is being read, analyzed, briefed, or synthesized in the other session.",
85
+ "recording_focus": "WHAT TO RECORD\n--------------\nFocus on legal knowledge and exam-ready insights:\n- Case holdings distilled to 2-3 sentences (key facts + holding + rule)\n- Legal tests, elements, and standards extracted from cases or statutes\n- Issue-spotting triggers: what fact patterns signal which legal issues\n- Professor's framing, emphasis, or analytical approach to a doctrine\n- Arguments and counter-arguments worked through\n- Connections across cases or doctrines that reveal underlying principles\n\nUse verbs like: held, established, synthesized, identified, distinguished, analyzed, revealed, connected\n\n✅ GOOD EXAMPLES (describes what was learned about the law):\n- \"Palsgraf established proximate cause requires the harm be foreseeable to the defendant at the time of conduct\"\n- \"Prof frames consideration doctrine around the bargain theory, not benefit-detriment — exam answers should reflect this\"\n- \"When fact pattern shows concurrent causation, issue-spot both but-for AND substantial factor tests\"\n\n❌ BAD EXAMPLES (describes observation process - DO NOT DO THIS):\n- \"Analyzed the case and recorded findings about proximate cause\"\n- \"Tracked professor's comments and stored the framework\"\n- \"Monitored discussion of consideration and noted the approach\"",
86
+ "skip_guidance": "WHEN TO SKIP\n------------\nSkip these — not worth recording:\n- Full case briefs (only record the 2-3 sentence distilled version with the rule)\n- Re-reading the same case or passage without new insight\n- Definitions of basic terms the student already knows\n- Routine case brief formatting with no analytical content\n- Simple fact summaries that don't extract a rule or pattern\n- Procedural history details not relevant to the legal rule\n- **No output necessary if skipping.**",
87
+ "type_guidance": "**type**: MUST be EXACTLY one of these 6 options (no other values allowed):\n - case-holding: case brief (2-3 sentences: key facts + holding) with extracted legal rule\n - issue-pattern: exam trigger or fact pattern that signals a legal issue to spot\n - prof-framework: professor's analytical lens, emphasis, or approach to a topic or doctrine\n - doctrine-rule: legal test, standard, or doctrine synthesized from cases, statutes, or restatements\n - argument-structure: legal argument or counter-argument worked through with analytical steps\n - cross-case-connection: insight linking multiple cases, doctrines, or topics that reveals a deeper principle",
88
+ "concept_guidance": "**concepts**: 2-5 knowledge-type categories. MUST use ONLY these exact keywords:\n - exam-relevant: flagged by professor or likely to appear on exams\n - minority-position: dissent, minority rule, or alternative jurisdictional approach\n - gotcha: subtle nuance, counterintuitive result, or common mistake\n - unsettled-law: circuit split, open question, or evolving area\n - policy-rationale: normative or policy argument underlying a rule\n - course-theme: connects to the overarching narrative or theory of the course\n\n IMPORTANT: Do NOT include the observation type (case-holding/issue-pattern/etc.) as a concept.\n Types and concepts are separate dimensions.",
89
+ "field_guidance": "**facts**: Concise, self-contained statements\nEach fact is ONE piece of information\n No pronouns - each fact must stand alone\n Include specific details: case names, rule elements, test names, jurisdiction\n\n**files**: All files or documents read (full paths from project root)",
90
+ "output_format_header": "OUTPUT FORMAT\n-------------\nOutput observations using this XML structure:",
91
+ "format_examples": "",
92
+ "footer": "IMPORTANT! DO NOT do any work right now other than generating this OBSERVATIONS from tool use messages - and remember that you are a memory agent designed to summarize a DIFFERENT claude code session, not this one.\n\nNever reference yourself or your own actions. Do not output anything other than the observation content formatted in the XML structure above. All other output is ignored by the system, and the system has been designed to be smart about token usage. Please spend your tokens wisely on useful observations.\n\nRemember that we record these observations as a way of helping us stay on track with our progress, and to help us keep important decisions and changes at the forefront of our minds! :) Thank you so much for your help!",
93
+
94
+ "xml_title_placeholder": "[**title**: Case name, doctrine name, or short description of the legal insight]",
95
+ "xml_subtitle_placeholder": "[**subtitle**: One sentence capturing the core legal rule or exam relevance (max 24 words)]",
96
+ "xml_fact_placeholder": "[Concise, self-contained legal fact — include case names, rule elements, test names]",
97
+ "xml_narrative_placeholder": "[**narrative**: Full legal context: what the case held or rule requires, how it connects to other doctrine, why it matters for exams or practice]",
98
+ "xml_concept_placeholder": "[exam-relevant | minority-position | gotcha | unsettled-law | policy-rationale | course-theme]",
99
+ "xml_file_placeholder": "[path/to/document]",
100
+
101
+ "xml_summary_request_placeholder": "[Short title capturing the legal topic studied AND what was analyzed or synthesized]",
102
+ "xml_summary_investigated_placeholder": "[What cases, statutes, or doctrines were read or examined in this session?]",
103
+ "xml_summary_learned_placeholder": "[What legal rules, patterns, or frameworks were extracted and understood?]",
104
+ "xml_summary_completed_placeholder": "[What study work was completed? Which cases briefed, which doctrines synthesized, which issue patterns identified?]",
105
+ "xml_summary_next_steps_placeholder": "[What topics, cases, or doctrines are being studied next in this session?]",
106
+ "xml_summary_notes_placeholder": "[Additional insights about exam strategy, professor emphasis, or cross-topic connections observed in this session]",
107
+
108
+ "header_memory_start": "LAW STUDY MEMORY START\n=======================",
109
+ "header_memory_continued": "LAW STUDY MEMORY CONTINUED\n===========================",
110
+ "header_summary_checkpoint": "LAW STUDY SUMMARY CHECKPOINT\n============================",
111
+
112
+ "continuation_greeting": "Hello memory agent, you are continuing to observe the primary Claude session doing legal study and case analysis.",
113
+ "continuation_instruction": "IMPORTANT: Continue generating observations from tool use messages using the XML structure below.",
114
+
115
+ "summary_instruction": "Write progress notes of what legal material was studied, what rules and patterns were extracted, and what's next. This is a checkpoint to capture study progress so far. The session is ongoing - more cases or doctrines may be analyzed after this summary. Write \"next_steps\" as the current study trajectory (what topics or cases are actively being worked through), not as post-session plans. Always write at least a minimal summary explaining current progress, even if study is still early, so that users see a summary output tied to each study block.",
116
+ "summary_context_label": "Claude's Full Response to User:",
117
+ "summary_format_instruction": "Respond in this XML format:",
118
+ "summary_footer": "IMPORTANT! DO NOT do any work right now other than generating this next PROGRESS SUMMARY - and remember that you are a memory agent designed to summarize a DIFFERENT claude code session, not this one.\n\nNever reference yourself or your own actions. Do not output anything other than the summary content formatted in the XML structure above. All other output is ignored by the system, and the system has been designed to be smart about token usage. Please spend your tokens wisely on useful summary content.\n\nThank you, this summary will be very useful for keeping track of legal study progress!"
119
+ }
120
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "vibelearn",
3
+ "version": "0.1.1",
4
+ "private": true,
5
+ "description": "Runtime dependencies for vibelearn bundled hooks",
6
+ "type": "module",
7
+ "dependencies": {
8
+ "tree-sitter-cli": "^0.26.5",
9
+ "tree-sitter-c": "^0.24.1",
10
+ "tree-sitter-cpp": "^0.23.4",
11
+ "tree-sitter-go": "^0.25.0",
12
+ "tree-sitter-java": "^0.23.5",
13
+ "tree-sitter-javascript": "^0.25.0",
14
+ "tree-sitter-python": "^0.25.0",
15
+ "tree-sitter-ruby": "^0.23.1",
16
+ "tree-sitter-rust": "^0.24.0",
17
+ "tree-sitter-typescript": "^0.23.2"
18
+ },
19
+ "engines": {
20
+ "node": ">=18.0.0",
21
+ "bun": ">=1.0.0"
22
+ }
23
+ }
@@ -0,0 +1,5 @@
1
+ Never read built source files in this directory. These are compiled outputs — read the source files in `src/` instead.
2
+
3
+ <vibelearn-context>
4
+
5
+ </vibelearn-context>
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Bun Runner - Finds and executes Bun even when not in PATH
4
+ *
5
+ * This script solves the fresh install problem where:
6
+ * 1. smart-install.js installs Bun to ~/.bun/bin/bun
7
+ * 2. But Bun isn't in PATH until terminal restart
8
+ * 3. Subsequent hooks fail because they can't find `bun`
9
+ *
10
+ * Usage: node bun-runner.js <script> [args...]
11
+ *
12
+ * Fixes #818: Worker fails to start on fresh install
13
+ */
14
+ import { spawnSync, spawn } from 'child_process';
15
+ import { existsSync, readFileSync } from 'fs';
16
+ import { join, dirname, resolve } from 'path';
17
+ import { homedir } from 'os';
18
+ import { fileURLToPath } from 'url';
19
+
20
+ const IS_WINDOWS = process.platform === 'win32';
21
+
22
+ // Self-resolve plugin root when CLAUDE_PLUGIN_ROOT is not set by Claude Code.
23
+ // Upstream bug: anthropics/claude-code#24529 — Stop hooks (and on Linux, all hooks)
24
+ // don't receive CLAUDE_PLUGIN_ROOT, causing script paths to resolve to /scripts/...
25
+ // which doesn't exist. This fallback derives the plugin root from bun-runner.js's
26
+ // own filesystem location (this file lives in <plugin-root>/scripts/).
27
+ const __bun_runner_dirname = dirname(fileURLToPath(import.meta.url));
28
+ const RESOLVED_PLUGIN_ROOT = process.env.CLAUDE_PLUGIN_ROOT || resolve(__bun_runner_dirname, '..');
29
+
30
+ /**
31
+ * Fix script path arguments that were broken by empty CLAUDE_PLUGIN_ROOT.
32
+ * When CLAUDE_PLUGIN_ROOT is empty, "${CLAUDE_PLUGIN_ROOT}/scripts/foo.cjs"
33
+ * expands to "/scripts/foo.cjs" which doesn't exist. Detect this and rewrite
34
+ * the path using our self-resolved plugin root.
35
+ */
36
+ function fixBrokenScriptPath(argPath) {
37
+ if (argPath.startsWith('/scripts/') && !existsSync(argPath)) {
38
+ const fixedPath = join(RESOLVED_PLUGIN_ROOT, argPath);
39
+ if (existsSync(fixedPath)) {
40
+ return fixedPath;
41
+ }
42
+ }
43
+ return argPath;
44
+ }
45
+
46
+ /**
47
+ * Find Bun executable - checks PATH first, then common install locations
48
+ */
49
+ function findBun() {
50
+ // Try PATH first
51
+ const pathCheck = spawnSync(IS_WINDOWS ? 'where' : 'which', ['bun'], {
52
+ encoding: 'utf-8',
53
+ stdio: ['pipe', 'pipe', 'pipe'],
54
+ shell: IS_WINDOWS
55
+ });
56
+
57
+ if (pathCheck.status === 0 && pathCheck.stdout.trim()) {
58
+ return 'bun'; // Found in PATH
59
+ }
60
+
61
+ // Check common installation paths (handles fresh installs before PATH reload)
62
+ // Windows: Bun installs to ~/.bun/bin/bun.exe (same as smart-install.js)
63
+ // Unix: Check default location plus common package manager paths
64
+ const bunPaths = IS_WINDOWS
65
+ ? [join(homedir(), '.bun', 'bin', 'bun.exe')]
66
+ : [
67
+ join(homedir(), '.bun', 'bin', 'bun'),
68
+ '/usr/local/bin/bun',
69
+ '/opt/homebrew/bin/bun',
70
+ '/home/linuxbrew/.linuxbrew/bin/bun'
71
+ ];
72
+
73
+ for (const bunPath of bunPaths) {
74
+ if (existsSync(bunPath)) {
75
+ return bunPath;
76
+ }
77
+ }
78
+
79
+ return null;
80
+ }
81
+
82
+ // Early exit if plugin is disabled in Claude Code settings (#781).
83
+ // Sync read + JSON parse — fastest possible check before spawning Bun.
84
+ function isPluginDisabledInClaudeSettings() {
85
+ try {
86
+ const configDir = process.env.CLAUDE_CONFIG_DIR || join(homedir(), '.claude');
87
+ const settingsPath = join(configDir, 'settings.json');
88
+ if (!existsSync(settingsPath)) return false;
89
+ const settings = JSON.parse(readFileSync(settingsPath, 'utf-8'));
90
+ return settings?.enabledPlugins?.['anergcorp@vibelearn'] === false;
91
+ } catch {
92
+ return false;
93
+ }
94
+ }
95
+
96
+ if (isPluginDisabledInClaudeSettings()) {
97
+ process.exit(0);
98
+ }
99
+
100
+ // Get args: node bun-runner.js <script> [args...]
101
+ const args = process.argv.slice(2);
102
+
103
+ if (args.length === 0) {
104
+ console.error('Usage: node bun-runner.js <script> [args...]');
105
+ process.exit(1);
106
+ }
107
+
108
+ // Fix broken script paths caused by empty CLAUDE_PLUGIN_ROOT (#1215)
109
+ args[0] = fixBrokenScriptPath(args[0]);
110
+
111
+ const bunPath = findBun();
112
+
113
+ if (!bunPath) {
114
+ console.error('Error: Bun not found. Please install Bun: https://bun.sh');
115
+ console.error('After installation, restart your terminal.');
116
+ process.exit(1);
117
+ }
118
+
119
+ // Fix #646: Buffer stdin in Node.js before passing to Bun.
120
+ // On Linux, Bun's libuv calls fstat() on inherited pipe fds and crashes with
121
+ // EINVAL when the pipe comes from Claude Code's hook system. By reading stdin
122
+ // in Node.js first and writing it to a fresh pipe, Bun receives a normal pipe
123
+ // that it can fstat() without errors.
124
+ function collectStdin() {
125
+ return new Promise((resolve) => {
126
+ // If stdin is a TTY (interactive), there's no piped data to collect
127
+ if (process.stdin.isTTY) {
128
+ resolve(null);
129
+ return;
130
+ }
131
+
132
+ const chunks = [];
133
+ process.stdin.on('data', (chunk) => chunks.push(chunk));
134
+ process.stdin.on('end', () => {
135
+ resolve(chunks.length > 0 ? Buffer.concat(chunks) : null);
136
+ });
137
+ process.stdin.on('error', () => {
138
+ // stdin may not be readable (e.g. already closed), treat as no data
139
+ resolve(null);
140
+ });
141
+
142
+ // Safety: if no data arrives within 5s, proceed without stdin
143
+ setTimeout(() => {
144
+ process.stdin.removeAllListeners();
145
+ process.stdin.pause();
146
+ resolve(chunks.length > 0 ? Buffer.concat(chunks) : null);
147
+ }, 5000);
148
+ });
149
+ }
150
+
151
+ const stdinData = await collectStdin();
152
+
153
+ // Spawn Bun with the provided script and args
154
+ // Use spawn (not spawnSync) to properly handle stdio
155
+ // Note: Don't use shell mode on Windows - it breaks paths with spaces in usernames
156
+ // Use windowsHide to prevent a visible console window from spawning on Windows
157
+ const child = spawn(bunPath, args, {
158
+ stdio: [stdinData ? 'pipe' : 'ignore', 'inherit', 'inherit'],
159
+ windowsHide: true,
160
+ env: process.env
161
+ });
162
+
163
+ // Write buffered stdin to child's pipe, then close it so the child sees EOF
164
+ if (stdinData && child.stdin) {
165
+ child.stdin.write(stdinData);
166
+ child.stdin.end();
167
+ }
168
+
169
+ child.on('error', (err) => {
170
+ console.error(`Failed to start Bun: ${err.message}`);
171
+ process.exit(1);
172
+ });
173
+
174
+ child.on('close', (code) => {
175
+ process.exit(code || 0);
176
+ });