maskweaver 0.9.5 → 0.9.6

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
@@ -1,668 +1,672 @@
1
- # ?렚 Maskweaver: Expert Persona Framework for OpenCode
2
-
3
- <div align="center">
4
-
5
- <img src="docs/images/hero.png" width="800" alt="Maskweaver Hero Image">
6
-
7
- > **The npm for AI personas** ??Level up your OpenCode assistant with expert personalities
8
-
9
- [![GitHub Release](https://img.shields.io/github/v/release/ulgerang/maskweaver?color=369eff&labelColor=black&logo=github&style=flat-square)](https://github.com/ulgerang/maskweaver/releases)
10
- [![License](https://img.shields.io/badge/license-MIT-white?labelColor=black&style=flat-square)](LICENSE)
11
- [![npm](https://img.shields.io/npm/v/maskweaver?color=ff6b35&labelColor=black&style=flat-square)](https://www.npmjs.com/package/maskweaver)
12
-
13
- [English](README.md) | [?쒓뎅??(README.ko.md)
14
-
15
- </div>
16
-
17
- ---
18
-
19
- ## ?뵆 OpenCode Plugin
20
-
21
- **Maskweaver is a handy plugin for [OpenCode](https://github.com/sst/opencode).**
22
-
23
- While it can be used as a standalone library, it works great with OpenCode to add expert personas to your coding workflow:
24
- - **Expert Personas (Masks)**: Standardized YAML profiles for legendary developers.
25
- - **Smart Delegation**: Multi-agent workflows optimized for OpenCode.
26
- - **Project Memory**: Hybrid semantic search for your entire codebase.
27
- - **?넅 Weave Workflow**: Phase-driven development with AI self-verification.
28
- - **?뵕 GDC Integration**: Graph-Driven Codebase support for enhanced research and design-time verification gates.
29
-
30
- ---
31
-
32
- ## Why Maskweaver?
33
-
34
- You're stuck debugging a race condition. Wouldn't it be great if **Linus Torvalds** could review your code?
35
-
36
- ```typescript
37
- // Instead of generic AI response...
38
- "You have a potential race condition in your code."
39
-
40
- // Get Linus-level insight:
41
- "This is stupid. You're not even using memory barriers. Read the
42
- assembly - the compiler reordered your loads. Use smp_rmb() or
43
- better yet, redesign this without the stupid lock."
44
- ```
45
-
46
- **Maskweaver makes this real.** It gives AI assistants expert personas (masks) with deep domain knowledge and distinct thinking styles.
47
-
48
- ---
49
-
50
- ## Installation
51
-
52
- ### For Humans
53
-
54
- Copy and paste this prompt to your LLM agent (Claude Code, AmpCode, Cursor, etc.):
55
-
56
- ```
57
- Install and configure maskweaver by following the instructions here:
58
- https://raw.githubusercontent.com/ulgerang/maskweaver/master/docs/installation.md
59
- ```
60
-
61
- Or read the [Installation Guide](docs/installation.md) directly?봟ut **we strongly recommend letting an agent handle it. Humans make mistakes.**
62
-
63
- ### For LLM Agents
64
-
65
- Fetch the installation guide and follow it:
66
-
67
- ```bash
68
- curl -s https://raw.githubusercontent.com/ulgerang/maskweaver/master/docs/installation.md
69
- ```
70
-
71
- ### Quick Install
72
-
73
- ```bash
74
- # npm
75
- npm install maskweaver
76
-
77
- # bun
78
- bun add maskweaver
79
- ```
80
-
81
- ### OpenCode Plugin Setup
82
-
83
- Add to your OpenCode config - that's it!
84
-
85
- **Global** (`~/.config/opencode/opencode.json`):
86
- ```json
87
- {
88
- "plugin": ["maskweaver"]
89
- }
90
- ```
91
-
92
- **Or per-project** (`opencode.json` in project root):
93
- ```json
94
- {
95
- "plugin": ["maskweaver"]
96
- }
97
- ```
98
-
99
- > Note: OpenCode installs npm packages by name. Use `maskweaver` (not `maskweaver/plugin`).
100
-
101
- OpenCode automatically installs the plugin to `~/.cache/opencode/node_modules/` on startup.
102
-
103
- **Windows:** `%USERPROFILE%\.config\opencode\opencode.json`
104
-
105
- ### Completion Sound (Optional)
106
-
107
- Maskweaver can play a notification sound when generation finishes (`session.idle`).
108
-
109
- Create `.opencode/maskweaver.json` (project) or `~/.config/opencode/maskweaver.json` (global):
110
-
111
- ```jsonc
112
- {
113
- "notifications": {
114
- "completionSound": {
115
- "enabled": true
116
- }
117
- }
118
- }
119
- ```
120
-
121
- Turn it off:
122
-
123
- ```jsonc
124
- {
125
- "notifications": {
126
- "completionSound": {
127
- "enabled": false
128
- }
129
- }
130
- }
131
- ```
132
-
133
- ### Checking Installed Version
134
-
135
- Multiple ways to verify your Maskweaver version:
136
-
137
- ```bash
138
- # CLI (terminal)
139
- maskweaver --version
140
- # or
141
- maskweaver -V
142
-
143
- # npm
144
- npm list maskweaver
145
-
146
- # In OpenCode chat
147
- # Use the maskweaver_status tool or type:
148
- /weave-help
149
- ```
150
-
151
- ```typescript
152
- // Programmatic (Node.js / TypeScript)
153
- import { VERSION } from 'maskweaver';
154
- console.log(VERSION); // "0.7.29"
155
- ```
156
-
157
- ---
158
-
159
- ## Quick Start
160
-
161
- ### First Use
162
-
163
- ```bash
164
- # In your AI assistant chat:
165
- @maskweaver Use Linus Torvalds mask to review this C code
166
-
167
- # Or delegate to dummy-humans:
168
- @dummy-human Linus mask: review my multithreading code
169
- @dummy-flash Find all files with "unsafe" in them
170
- @dummy-premium Design microservices architecture for this monolith
171
- ```
172
-
173
- ---
174
-
175
- ## Features
176
-
177
- ### ?렚 Expert Personas (Masks)
178
-
179
- Apply legendary developer personalities to your AI assistant:
180
-
181
- ```yaml
182
- # masks/software-engineering/linus-torvalds.yaml
183
- profile:
184
- name: Linus Torvalds
185
- expertise:
186
- - Kernel-level systems programming
187
- - Performance optimization
188
- - Memory management and concurrency
189
-
190
- thinkingStyle: |
191
- Bottom-up, pragmatic. Starts with code, not theory.
192
- Ruthlessly eliminates complexity.
193
- ```
194
-
195
- **Current Masks:**
196
- - ?맕 **Linus Torvalds** - Systems, C, Linux, performance
197
- - ?룛截?**Martin Fowler** - Architecture, refactoring, patterns
198
- - ?㎦ **Kent Beck** - TDD, XP, testing
199
- - ?쭬 **Andrew Ng** - ML/AI systems
200
- - ?쏉툘 **Dan Abramov** - React, frontend architecture
201
-
202
- ### ?쨼 Dummy-Human System
203
-
204
- Smart subagents for cost-efficient multi-agent workflows:
205
-
206
- | Agent | Model Tier | Cost | Best For |
207
- |-------|-----------|------|----------|
208
- | `@dummy-flash` | Fast | ?뮥 | File search, summaries, simple tasks |
209
- | `@dummy-human` | Balanced | ?뮥?뮥 | Code writing, reviews, general work |
210
- | `@dummy-premium` | Powerful | ?뮥?뮥?뮥 | Architecture, complex debugging |
211
-
212
- ### ?㏊ Weave Workflow
213
-
214
- **Phase-Driven Development** ??"AI verifies, Human validates"
215
-
216
- Weave is Maskweaver's flagship workflow. It breaks work into testable phases, auto-selects expert masks, and provides structured verification before handoff.
217
-
218
- #### Commands
219
-
220
- | Command | Description |
221
- |---------|-------------|
222
- | `/weave-init` | Initialize Weave (once per repo) |
223
- | `/weave-prepare [docs]` | Generate research + spec + plan in one step (auto-split if oversized) |
224
- | `/weave-refine-plan` | Apply structured plan notes (`tasks/plan-notes.md`) to active plan |
225
- | `/weave-approve` | Explicit human approval gate before implementation |
226
- | `/weave-craft [P#]` | Prepare phase execution context and guidance |
227
- | `/build` | Autonomous build loop (`action=run/status/stop/list/resume/sync`) |
228
- | `/weave-verify` | Run build/test verification (auto-detect) |
229
- | `/weave-worktree ...` | Manage git worktrees for parallel work |
230
- | `/weave-status` | View project progress and stats |
231
- | `/weave-agents` | Sync agent files or init config (`sync=true` / `init=true`) |
232
- | `/weave-troubleshoot` | Search global knowledge (`record=true` to save a solution) |
233
- | `/weave-archive` | Archive the verified active change |
234
- | `/weave-help` | Show documentation |
235
-
236
- > Tip: In OpenCode chat, use the visible slash commands above. They map to the underlying `weave command=...` tool calls.
237
-
238
- #### Workflow
239
-
240
- ```
241
- 0. INIT (once): /weave-init
242
- ??1. PLAN: /weave-prepare docs/
243
- - Generates research + spec + phase plan (auto-splits if oversized)
244
- ??2. REFINE (optional): /weave-refine-plan
245
- - apply annotation notes from tasks/plan-notes.md
246
- ??3. APPROVAL GATE: /weave-approve
247
- - required before craft execution
248
- ??4. CRAFT: /weave-craft
249
- - Generates an execution plan and next actions
250
- - Implement/verify changes, then finalize with approve
251
- - Use `/weave-verify` anytime for build/test checks
252
- ??5. HANDOFF: You validate UX/intent and move to next phase
253
- ```
254
-
255
- #### Multi-Layer AI Verification
256
-
257
- Before handing off to you, AI runs these verification layers:
258
-
259
- | Layer | Type | Tool |
260
- |-------|------|------|
261
- | 1截뤴깵 TypeCheck | Build | `tsc --noEmit` |
262
- | 2截뤴깵 Lint | Build | `eslint` |
263
- | 3截뤴깵 Build | Build | `npm run build` |
264
- | 4截뤴깵 Unit Tests | Test | `jest` / `vitest` |
265
- | 5截뤴깵 E2E Tests | Test | **Playwright** |
266
- | 6截뤴깵 Screenshot | Visual | Playwright / browser capture |
267
- | 7截뤴깵 API Check | API | `fetch` health checks |
268
- | 8截뤴깵 A11y | Accessibility | `axe-core` |
269
- | 0截뤴깵 GDC Check | Design | `gdc check --machine` |
270
-
271
- #### GDC Integration (Graph-Driven Codebase)
272
-
273
- Weave integrates with [GDC](https://github.com/ulgerang/gdc) (Graph-Driven Codebase) to enhance research quality and add design-time verification gates:
274
-
275
- **Research Enhancement:**
276
- - Automatic `.gdc` workspace detection
277
- - `weave init` probe chain (`version`/`sync`/`check`/`stats`) for quick integration health check
278
- - GDC `stats`, `graph`, and `check` results embedded in `tasks/research.md`
279
- - Dependency blast radius analysis from graph edges
280
- - Candidate reuse nodes matched against feature keywords
281
- - New report sections: `GDC Node Coverage`, `Dependency Blast Radius`, `Existing Spec vs Implementation Drift`, `Candidate Reuse Nodes`
282
-
283
- **Execution Enhancements:**
284
- - `weave craft` can generate node context files via `gdc extract` and link them in `tasks/todo.md`
285
- - `weave status` includes GDC node/check metrics (`total/implemented/tested`, issue summary)
286
- - `weave worktree create` can bootstrap `.gdc/config.yaml` and `.gdc/nodes/**` (without `.gdc/graph.db`)
287
-
288
- **Pre-Verify Gate:**
289
- When GDC is detected, `weave verify` and `weave flow` automatically run:
290
- 1. `gdc sync --machine` - Sync specs with implementation
291
- 2. `gdc check --machine` - Validate spec/implementation alignment
292
-
293
- Blocking errors from GDC check will halt verification (configurable via `strictVerify` mode).
294
-
295
- **Configuration** (`maskweaver.config.json`):
296
- ```json
297
- {
298
- "gdc": {
299
- "enabled": "auto",
300
- "strictVerify": false,
301
- "autoSyncOnPrepare": true,
302
- "extractContext": {
303
- "withImpl": true,
304
- "withTests": true,
305
- "withCallers": true
306
- }
307
- }
308
- }
309
- ```
310
-
311
- - `enabled`: `true` | `false` | `"auto"` (default: auto-detect from `.gdc` directory)
312
- - `strictVerify`: If `true`, GDC check failures block verification; if `false`, continues with warning
313
- - `autoSyncOnPrepare`: Run `gdc sync` during `weave prepare`
314
- - `extractContext`: Controls `gdc extract` evidence flags during `weave craft`
315
-
316
- #### Autonomous Mask Selection
317
-
318
- The AI automatically picks the best expert for each task:
319
-
320
- | Task Type | Auto-Selected Mask |
321
- |-----------|-------------------|
322
- | Architecture/Design | ?룛截?Martin Fowler |
323
- | Testing/TDD | ?㎦ Kent Beck |
324
- | React/Frontend | ?쏉툘 Dan Abramov |
325
- | Performance/Systems | ?맕 Linus Torvalds |
326
- | ML/AI | ?쭬 Andrew Ng |
327
-
328
- #### Global Knowledge Base (Cross-Project RAG)
329
-
330
- Troubleshooting solutions are stored globally and shared across all projects:
331
-
332
- ```
333
- Error occurs ??Search ~/.maskweaver/knowledge.sqlite
334
- ?쒋??€ Found ??Apply solution ??Retry
335
- ?붴??€ Not found ??Fix manually ??Record solution for future
336
- ```
337
-
338
- ### ?쭬 Memory System
339
-
340
- Remember past conversations, decisions, and mask effectiveness:
341
-
342
- ```typescript
343
- import { memory } from 'maskweaver';
344
-
345
- // Index your project knowledge
346
- await memory.indexFile('./docs/architecture.md', embedFn);
347
-
348
- // Semantic search with multiple providers:
349
- const results = await memory.hybridSearch(
350
- 'How does authentication work?',
351
- embedding,
352
- { limit: 5, minScore: 0.7 }
353
- );
354
- ```
355
-
356
- **Embedding Providers:**
357
- - ?쬂 **Ollama** - Local, private (bge-m3, nomic-embed)
358
- - ?쨼 **OpenAI** - text-embedding-3-large
359
- - ?? **VoyageAI** - Code-specialized embeddings!
360
- - ?? **OpenRouter** - Access to multiple providers
361
- - ?뱷 **Text-only** - No embeddings, pure FTS5
362
-
363
- ### ?뾺截?Context System
364
-
365
- Track long-running features with file associations:
366
-
367
- ```bash
368
- # Start a feature
369
- @context start name="oauth-login" goal="Implement OAuth2 flow"
370
-
371
- # Add files to feature context
372
- @context add file="src/auth/oauth.ts"
373
-
374
- # Check status
375
- @context status
376
-
377
- # Mark as done
378
- @context done
379
- ```
380
-
381
- ### ?봽 Retrospect System
382
-
383
- Evaluate mask effectiveness after each session:
384
-
385
- ```typescript
386
- {
387
- "trigger": "session_end",
388
- "masksUsed": [
389
- {
390
- "name": "linus-torvalds",
391
- "task": "Review multithreading code",
392
- "effectiveness": 9.5
393
- }
394
- ],
395
- "wellDone": ["Found 3 critical race conditions"],
396
- "lessons": ["Linus mask excels at concurrency reviews"]
397
- }
398
- ```
399
-
400
- ---
401
-
402
- ## ?벀 Package Structure
403
-
404
- Maskweaver is a single npm package with modular exports:
405
-
406
- ```typescript
407
- // Default export - OpenCode plugin
408
- import maskweaver from 'maskweaver';
409
-
410
- // Named exports - module namespaces
411
- import { core, memory, context, retrospect, verify, weave } from 'maskweaver';
412
-
413
- // Subpath imports - direct module access
414
- import { hybridSearch } from 'maskweaver/memory';
415
- import { createFeature } from 'maskweaver/context';
416
- import { MaskLoader } from 'maskweaver/core';
417
- import { WeaveOrchestrator, GlobalKnowledge } from 'maskweaver/weave';
418
- ```
419
-
420
- **Modules:**
421
- - `maskweaver/core` - Mask loading, validation (YAML/JSON)
422
- - `maskweaver/memory` - Embeddings + vector search (5 providers)
423
- - `maskweaver/context` - Feature-based work tracking
424
- - `maskweaver/verify` - Cross-mask code review
425
- - `maskweaver/retrospect` - Session effectiveness analysis
426
- - `maskweaver/weave` - Phase-driven development workflow
427
- - `maskweaver/gdc` - GDC (Graph-Driven Codebase) integration utilities
428
- - `maskweaver/plugin` - OpenCode plugin entry point
429
-
430
- ---
431
-
432
- ## ?㏊ Weave Usage Guide
433
-
434
- ### Step 0: Initialize (Once)
435
-
436
- ```bash
437
- /weave-init
438
- ```
439
-
440
- ### Step 1: Create a Plan
441
-
442
- Generate research + spec + plan in one command:
443
-
444
- ```bash
445
- /weave-prepare docs/
446
- ```
447
-
448
- Then approve the plan:
449
-
450
- ```bash
451
- /weave-approve
452
- ```
453
-
454
- The AI will:
455
- 1. Read all documents in the path
456
- 2. Search memory for similar past projects
457
- 3. Ask clarifying questions if needed
458
- 4. Present a **Phase Plan** for your approval
459
-
460
- Example output:
461
- ```markdown
462
- ## ?뱥 Execution Plan
463
-
464
- ### Vision
465
- Build a modern emotion diary app with AI-powered insights
466
-
467
- ### Phases
468
- | Phase | Name | Done When | Est. Time |
469
- |-------|------|-----------|-----------|
470
- | P1 | Emotion Selection UI | User can select emotions | 2-3h |
471
- | P2 | Data Persistence | Emotions saved to storage | 2-3h |
472
- | P3 | History View | User can view past entries | 2-3h |
473
-
474
- Is this plan okay? Let me know if changes are needed.
475
- ```
476
-
477
- ### Step 2: Approve the Plan (Required)
478
-
479
- ```bash
480
- /weave-approve
481
- ```
482
-
483
- ### Step 3: Craft a Phase (Auto-select if omitted)
484
-
485
- Start with the first phase:
486
-
487
- ```bash
488
- /weave-craft
489
- ```
490
-
491
- `/weave-craft` returns execution context for the phase. Implement changes, then rerun `/weave-craft` if you want to refresh the plan view.
492
-
493
- ### Step 4: Continue Implementation
494
-
495
- ```txt
496
- weave command=craft phaseId="P1"
497
- weave command=verify
498
- ```
499
-
500
- Autonomous build loop:
501
-
502
- ```txt
503
- weave command=build action=run phaseIds="P1,P2"
504
- ```
505
-
506
- ### Step 5: Finalize the Phase
507
-
508
- ```txt
509
- weave command=verify
510
- weave command=approve
511
- ```
512
-
513
- ### Step 6: Handoff & Validate
514
-
515
- When all verifications pass:
516
-
517
- ```markdown
518
- ## ??Phase P1 Verification Complete!
519
-
520
- ### ?쨼 AI Test Results
521
- | Test | Result |
522
- |------|--------|
523
- | Build | ??Success |
524
- | Unit Tests | ??15/15 |
525
- | Lint | ??Passed |
526
-
527
- ### ?렚 Masks Used
528
- - Kent Beck (testing)
529
- - Dan Abramov (React components)
530
-
531
- ### ?뵕 Access
532
- http://localhost:5173
533
-
534
- ### ?뫀 Human Validation (Only you can judge)
535
- - [ ] Does it feel right?
536
- - [ ] Is the UX good?
537
- - [ ] Is this what you wanted?
538
-
539
- **[Approve]** **[Request Changes]** **[Later]**
540
- ```
541
-
542
- ### Step 6: Check Status Anytime
543
-
544
- ```bash
545
- /weave-status
546
- ```
547
-
548
- Output:
549
- ```markdown
550
- ## ?뱤 Weave Progress
551
-
552
- **Project**: Emotion Diary App
553
- **Progress**: 40%
554
-
555
- [?댿뻽?댿뻽?댿뻽?댿뻽?묅뼇?묅뼇?묅뼇?묅뼇?묅뼇?묅뼇] 2/5
556
-
557
- ### Phases
558
- ??**P1**: Emotion Selection UI (2.5h) [kent-beck, dan-abramov]
559
- ?봽 **P2**: Data Persistence
560
- ??**P3**: History View
561
- ??**P4**: Statistics
562
- ??**P5**: Theme Settings
563
-
564
- ### Global Knowledge Stats
565
- - Total troubleshooting records: 47
566
- - Used in this project: 3
567
- - Newly recorded: 1
568
- ```
569
-
570
- ---
571
-
572
- ## ?렚 Creating Masks
573
-
574
- Masks are simple YAML files:
575
-
576
- ```yaml
577
- # masks/my-expert.yaml
578
- metadata:
579
- id: my-expert
580
- version: '1.0'
581
- language: en
582
-
583
- profile:
584
- name: Ada Lovelace
585
- tagline: Pioneer of Computing - First Programmer
586
-
587
- expertise:
588
- - Algorithm design
589
- - Mathematical thinking
590
- - Analytical engines
591
-
592
- thinkingStyle: |
593
- Combines mathematical rigor with poetic imagination.
594
- Sees patterns others miss.
595
-
596
- behavior:
597
- systemPrompt: |
598
- You are Ada Lovelace, the first computer programmer.
599
-
600
- You see algorithms as poetry - elegant, precise, beautiful.
601
- You think in terms of mathematical transformations and
602
- logical flows.
603
-
604
- communicationStyle:
605
- tone: thoughtful
606
- verbosity: moderate
607
- technicalDepth: expert
608
-
609
- usage:
610
- suitableFor:
611
- - Algorithm design and optimization
612
- - Mathematical problem-solving
613
- - Pattern recognition in code
614
- ```
615
-
616
- ---
617
-
618
- ## ?뙇 Multilingual
619
-
620
- Infrastructure ready for:
621
- - ?눣?눡 English
622
- - ?눖?눟 Korean
623
- - ?눊?눛 Chinese *(coming soon)*
624
- - ?눓?눝 Japanese *(coming soon)*
625
-
626
- Masks can have multiple language versions:
627
- ```
628
- masks/
629
- ?쒋??€ linus-torvalds.en.yaml
630
- ?쒋??€ linus-torvalds.ko.yaml
631
- ?붴??€ linus-torvalds.zh.yaml
632
- ```
633
-
634
- ---
635
-
636
- ## ?쩃 Contributing
637
-
638
- We need your help!
639
-
640
- ### Add a Mask
641
-
642
- Create a YAML file in `masks/` and submit a PR:
643
- - ??Real expertise (domain knowledge)
644
- - ??Distinct personality (thinking style)
645
- - ??Clear use cases (when to use)
646
- - ??Examples (expected behavior)
647
-
648
- ### Report Bugs
649
-
650
- Open an issue with:
651
- 1. What you tried
652
- 2. What happened
653
- 3. What you expected
654
-
655
- See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
656
-
657
- ---
658
-
659
- ## ?뱞 License
660
-
661
- MIT - See [LICENSE](LICENSE)
662
-
663
- ---
664
-
665
- <p align="center">
666
- <sub>Crafted with ?렚 by <a href="https://github.com/ulgerang">ULJI SOFT</a></sub>
667
- </p>
1
+ # 🎭 Maskweaver: Expert Persona Framework for OpenCode
668
2
 
3
+ <div align="center">
4
+
5
+ <img src="docs/images/hero.png" width="800" alt="Maskweaver Hero Image">
6
+
7
+ > **The npm for AI personas** — Level up your OpenCode assistant with expert personalities
8
+
9
+ [![GitHub Release](https://img.shields.io/github/v/release/ulgerang/maskweaver?color=369eff&labelColor=black&logo=github&style=flat-square)](https://github.com/ulgerang/maskweaver/releases)
10
+ [![License](https://img.shields.io/badge/license-MIT-white?labelColor=black&style=flat-square)](LICENSE)
11
+ [![npm](https://img.shields.io/npm/v/maskweaver?color=ff6b35&labelColor=black&style=flat-square)](https://www.npmjs.com/package/maskweaver)
12
+
13
+ [English](README.md) | [한국어](README.ko.md)
14
+
15
+ </div>
16
+
17
+ ---
18
+
19
+ ## 🔌 OpenCode Plugin
20
+
21
+ **Maskweaver is a handy plugin for [OpenCode](https://github.com/sst/opencode).**
22
+
23
+ While it can be used as a standalone library, it works great with OpenCode to add expert personas to your coding workflow:
24
+ - **Expert Personas (Masks)**: Standardized YAML profiles for legendary developers.
25
+ - **Smart Delegation**: Multi-agent workflows optimized for OpenCode.
26
+ - **Project Memory**: Hybrid semantic search for your entire codebase.
27
+ - **🆕 Weave Workflow**: Phase-driven development with AI self-verification.
28
+ - **🔗 GDC Integration**: Graph-Driven Codebase support for enhanced research and design-time verification gates.
29
+
30
+ ---
31
+
32
+ ## Why Maskweaver?
33
+
34
+ You're stuck debugging a race condition. Wouldn't it be great if **Linus Torvalds** could review your code?
35
+
36
+ ```typescript
37
+ // Instead of generic AI response...
38
+ "You have a potential race condition in your code."
39
+
40
+ // Get Linus-level insight:
41
+ "This is stupid. You're not even using memory barriers. Read the
42
+ assembly - the compiler reordered your loads. Use smp_rmb() or
43
+ better yet, redesign this without the stupid lock."
44
+ ```
45
+
46
+ **Maskweaver makes this real.** It gives AI assistants expert personas (masks) with deep domain knowledge and distinct thinking styles.
47
+
48
+ ---
49
+
50
+ ## Installation
51
+
52
+ ### For Humans
53
+
54
+ Copy and paste this prompt to your LLM agent (Claude Code, AmpCode, Cursor, etc.):
55
+
56
+ ```
57
+ Install and configure maskweaver by following the instructions here:
58
+ https://raw.githubusercontent.com/ulgerang/maskweaver/master/docs/installation.md
59
+ ```
60
+
61
+ Or read the [Installation Guide](docs/installation.md) directly—but **we strongly recommend letting an agent handle it. Humans make mistakes.**
62
+
63
+ ### For LLM Agents
64
+
65
+ Fetch the installation guide and follow it:
66
+
67
+ ```bash
68
+ curl -s https://raw.githubusercontent.com/ulgerang/maskweaver/master/docs/installation.md
69
+ ```
70
+
71
+ ### Quick Install
72
+
73
+ ```bash
74
+ # npm
75
+ npm install maskweaver
76
+
77
+ # bun
78
+ bun add maskweaver
79
+ ```
80
+
81
+ ### OpenCode Plugin Setup
82
+
83
+ Add to your OpenCode config - that's it!
84
+
85
+ **Global** (`~/.config/opencode/opencode.json`):
86
+ ```json
87
+ {
88
+ "plugin": ["maskweaver"]
89
+ }
90
+ ```
91
+
92
+ **Or per-project** (`opencode.json` in project root):
93
+ ```json
94
+ {
95
+ "plugin": ["maskweaver"]
96
+ }
97
+ ```
98
+
99
+ > Note: OpenCode installs npm packages by name. Use `maskweaver` (not `maskweaver/plugin`).
100
+
101
+ OpenCode automatically installs the plugin to `~/.cache/opencode/node_modules/` on startup.
102
+
103
+ **Windows:** `%USERPROFILE%\.config\opencode\opencode.json`
104
+
105
+ ### Completion Sound (Optional)
106
+
107
+ Maskweaver can play a notification sound when generation finishes (`session.idle`).
108
+
109
+ Create `.opencode/maskweaver.json` (project) or `~/.config/opencode/maskweaver.json` (global):
110
+
111
+ ```jsonc
112
+ {
113
+ "notifications": {
114
+ "completionSound": {
115
+ "enabled": true
116
+ }
117
+ }
118
+ }
119
+ ```
120
+
121
+ Turn it off:
122
+
123
+ ```jsonc
124
+ {
125
+ "notifications": {
126
+ "completionSound": {
127
+ "enabled": false
128
+ }
129
+ }
130
+ }
131
+ ```
132
+
133
+ ### Checking Installed Version
134
+
135
+ Multiple ways to verify your Maskweaver version:
136
+
137
+ ```bash
138
+ # CLI (terminal)
139
+ maskweaver --version
140
+ # or
141
+ maskweaver -V
142
+
143
+ # npm
144
+ npm list maskweaver
145
+
146
+ # In OpenCode chat
147
+ # Use the maskweaver_status tool or type:
148
+ /weave-help
149
+ ```
150
+
151
+ ```typescript
152
+ // Programmatic (Node.js / TypeScript)
153
+ import { VERSION } from 'maskweaver';
154
+ console.log(VERSION); // "0.7.29"
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Quick Start
160
+
161
+ ### First Use
162
+
163
+ ```bash
164
+ # In your AI assistant chat:
165
+ @maskweaver Use Linus Torvalds mask to review this C code
166
+
167
+ # Or delegate to dummy-humans:
168
+ @dummy-human Linus mask: review my multithreading code
169
+ @dummy-flash Find all files with "unsafe" in them
170
+ @dummy-premium Design microservices architecture for this monolith
171
+ ```
172
+
173
+ ---
174
+
175
+ ## Features
176
+
177
+ ### 🎭 Expert Personas (Masks)
178
+
179
+ Apply legendary developer personalities to your AI assistant:
180
+
181
+ ```yaml
182
+ # masks/software-engineering/linus-torvalds.yaml
183
+ profile:
184
+ name: Linus Torvalds
185
+ expertise:
186
+ - Kernel-level systems programming
187
+ - Performance optimization
188
+ - Memory management and concurrency
189
+
190
+ thinkingStyle: |
191
+ Bottom-up, pragmatic. Starts with code, not theory.
192
+ Ruthlessly eliminates complexity.
193
+ ```
194
+
195
+ **Current Masks:**
196
+ - 🐧 **Linus Torvalds** - Systems, C, Linux, performance
197
+ - 🏗️ **Martin Fowler** - Architecture, refactoring, patterns
198
+ - 🧪 **Kent Beck** - TDD, XP, testing
199
+ - 🧠 **Andrew Ng** - ML/AI systems
200
+ - ⚛️ **Dan Abramov** - React, frontend architecture
201
+
202
+ ### 🤖 Dummy-Human System
203
+
204
+ Smart subagents for cost-efficient multi-agent workflows:
205
+
206
+ | Agent | Model Tier | Cost | Best For |
207
+ |-------|-----------|------|----------|
208
+ | `@dummy-flash` | Fast | 💰 | File search, summaries, simple tasks |
209
+ | `@dummy-human` | Balanced | 💰💰 | Code writing, reviews, general work |
210
+ | `@dummy-premium` | Powerful | 💰💰💰 | Architecture, complex debugging |
211
+
212
+ ### 🧵 Weave Workflow
213
+
214
+ **Phase-Driven Development** — "AI verifies, Human validates"
215
+
216
+ Weave is Maskweaver's flagship workflow. It breaks work into testable phases, auto-selects expert masks, and provides structured verification before handoff.
217
+
218
+ #### Commands
219
+
220
+ | Command | Description |
221
+ |---------|-------------|
222
+ | `/weave-init` | Initialize Weave (once per repo) |
223
+ | `/weave-prepare [docs]` | Generate research + spec + plan in one step (auto-split if oversized) |
224
+ | `/weave-refine-plan` | Apply structured plan notes (`tasks/plan-notes.md`) to active plan |
225
+ | `/weave-approve` | Explicit human approval gate before implementation |
226
+ | `/weave-craft [P#]` | Prepare phase execution context and guidance |
227
+ | `/build` | Autonomous build loop (`action=run/status/stop/list/resume/sync`) |
228
+ | `/weave-verify` | Run build/test verification (auto-detect) |
229
+ | `/weave-worktree ...` | Manage git worktrees for parallel work |
230
+ | `/weave-status` | View project progress and stats |
231
+ | `/weave-agents` | Sync agent files or init config (`sync=true` / `init=true`) |
232
+ | `/weave-troubleshoot` | Search global knowledge (`record=true` to save a solution) |
233
+ | `/weave-archive` | Archive the verified active change |
234
+ | `/weave-help` | Show documentation |
235
+
236
+ > Tip: In OpenCode chat, use the visible slash commands such as `/weave-prepare` and `/build`; they map to the underlying `weave command=...` tool calls.
237
+
238
+ #### Workflow
239
+
240
+ ```
241
+ 0. INIT (once): /weave-init
242
+
243
+ 1. PLAN: /weave-prepare docs/
244
+ - Generates research + spec + phase plan (auto-splits if oversized)
245
+
246
+ 2. REFINE (optional): /weave-refine-plan
247
+ - apply annotation notes from tasks/plan-notes.md
248
+
249
+ 3. APPROVAL GATE: /weave-approve
250
+ - required before craft execution
251
+
252
+ 4. CRAFT: /weave-craft
253
+ - Generates an execution plan and next actions
254
+ - Implement/verify changes, then finalize with approve
255
+ - Use `/weave-verify` anytime for build/test checks
256
+
257
+ 5. HANDOFF: You validate UX/intent and move to next phase
258
+ ```
259
+
260
+ #### Multi-Layer AI Verification
261
+
262
+ Before handing off to you, AI runs these verification layers:
263
+
264
+ | Layer | Type | Tool |
265
+ |-------|------|------|
266
+ | 1️⃣ TypeCheck | Build | `tsc --noEmit` |
267
+ | 2️⃣ Lint | Build | `eslint` |
268
+ | 3️⃣ Build | Build | `npm run build` |
269
+ | 4️⃣ Unit Tests | Test | `jest` / `vitest` |
270
+ | 5️⃣ E2E Tests | Test | **Playwright** |
271
+ | 6️⃣ Screenshot | Visual | Playwright / browser capture |
272
+ | 7️⃣ API Check | API | `fetch` health checks |
273
+ | 8️⃣ A11y | Accessibility | `axe-core` |
274
+ | 0️⃣ GDC Check | Design | `gdc check --machine` |
275
+
276
+ #### GDC Integration (Graph-Driven Codebase)
277
+
278
+ Weave integrates with [GDC](https://github.com/ulgerang/gdc) (Graph-Driven Codebase) to enhance research quality and add design-time verification gates:
279
+
280
+ **Research Enhancement:**
281
+ - Automatic `.gdc` workspace detection
282
+ - `weave init` probe chain (`version`/`sync`/`check`/`stats`) for quick integration health check
283
+ - GDC `stats`, `graph`, and `check` results embedded in `tasks/research.md`
284
+ - Dependency blast radius analysis from graph edges
285
+ - Candidate reuse nodes matched against feature keywords
286
+ - New report sections: `GDC Node Coverage`, `Dependency Blast Radius`, `Existing Spec vs Implementation Drift`, `Candidate Reuse Nodes`
287
+
288
+ **Execution Enhancements:**
289
+ - `weave craft` can generate node context files via `gdc extract` and link them in `tasks/todo.md`
290
+ - `weave status` includes GDC node/check metrics (`total/implemented/tested`, issue summary)
291
+ - `weave worktree create` can bootstrap `.gdc/config.yaml` and `.gdc/nodes/**` (without `.gdc/graph.db`)
292
+
293
+ **Pre-Verify Gate:**
294
+ When GDC is detected, `weave verify` and `weave flow` automatically run:
295
+ 1. `gdc sync --machine` - Sync specs with implementation
296
+ 2. `gdc check --machine` - Validate spec/implementation alignment
297
+
298
+ Blocking errors from GDC check will halt verification (configurable via `strictVerify` mode).
299
+
300
+ **Configuration** (`maskweaver.config.json`):
301
+ ```json
302
+ {
303
+ "gdc": {
304
+ "enabled": "auto",
305
+ "strictVerify": false,
306
+ "autoSyncOnPrepare": true,
307
+ "extractContext": {
308
+ "withImpl": true,
309
+ "withTests": true,
310
+ "withCallers": true
311
+ }
312
+ }
313
+ }
314
+ ```
315
+
316
+ - `enabled`: `true` | `false` | `"auto"` (default: auto-detect from `.gdc` directory)
317
+ - `strictVerify`: If `true`, GDC check failures block verification; if `false`, continues with warning
318
+ - `autoSyncOnPrepare`: Run `gdc sync` during `weave prepare`
319
+ - `extractContext`: Controls `gdc extract` evidence flags during `weave craft`
320
+
321
+ #### Autonomous Mask Selection
322
+
323
+ The AI automatically picks the best expert for each task:
324
+
325
+ | Task Type | Auto-Selected Mask |
326
+ |-----------|-------------------|
327
+ | Architecture/Design | 🏗️ Martin Fowler |
328
+ | Testing/TDD | 🧪 Kent Beck |
329
+ | React/Frontend | ⚛️ Dan Abramov |
330
+ | Performance/Systems | 🐧 Linus Torvalds |
331
+ | ML/AI | 🧠 Andrew Ng |
332
+
333
+ #### Global Knowledge Base (Cross-Project RAG)
334
+
335
+ Troubleshooting solutions are stored globally and shared across all projects:
336
+
337
+ ```
338
+ Error occurs → Search ~/.maskweaver/knowledge.sqlite
339
+ ├── Found → Apply solution → Retry
340
+ └── Not found → Fix manually → Record solution for future
341
+ ```
342
+
343
+ ### 🧠 Memory System
344
+
345
+ Remember past conversations, decisions, and mask effectiveness:
346
+
347
+ ```typescript
348
+ import { memory } from 'maskweaver';
349
+
350
+ // Index your project knowledge
351
+ await memory.indexFile('./docs/architecture.md', embedFn);
352
+
353
+ // Semantic search with multiple providers:
354
+ const results = await memory.hybridSearch(
355
+ 'How does authentication work?',
356
+ embedding,
357
+ { limit: 5, minScore: 0.7 }
358
+ );
359
+ ```
360
+
361
+ **Embedding Providers:**
362
+ - 🦙 **Ollama** - Local, private (bge-m3, nomic-embed)
363
+ - 🤖 **OpenAI** - text-embedding-3-large
364
+ - 🚀 **VoyageAI** - Code-specialized embeddings!
365
+ - 🔀 **OpenRouter** - Access to multiple providers
366
+ - 📝 **Text-only** - No embeddings, pure FTS5
367
+
368
+ ### 🗂️ Context System
369
+
370
+ Track long-running features with file associations:
371
+
372
+ ```bash
373
+ # Start a feature
374
+ @context start name="oauth-login" goal="Implement OAuth2 flow"
375
+
376
+ # Add files to feature context
377
+ @context add file="src/auth/oauth.ts"
378
+
379
+ # Check status
380
+ @context status
381
+
382
+ # Mark as done
383
+ @context done
384
+ ```
385
+
386
+ ### 🔄 Retrospect System
387
+
388
+ Evaluate mask effectiveness after each session:
389
+
390
+ ```typescript
391
+ {
392
+ "trigger": "session_end",
393
+ "masksUsed": [
394
+ {
395
+ "name": "linus-torvalds",
396
+ "task": "Review multithreading code",
397
+ "effectiveness": 9.5
398
+ }
399
+ ],
400
+ "wellDone": ["Found 3 critical race conditions"],
401
+ "lessons": ["Linus mask excels at concurrency reviews"]
402
+ }
403
+ ```
404
+
405
+ ---
406
+
407
+ ## 📦 Package Structure
408
+
409
+ Maskweaver is a single npm package with modular exports:
410
+
411
+ ```typescript
412
+ // Default export - OpenCode plugin
413
+ import maskweaver from 'maskweaver';
414
+
415
+ // Named exports - module namespaces
416
+ import { core, memory, context, retrospect, verify, weave } from 'maskweaver';
417
+
418
+ // Subpath imports - direct module access
419
+ import { hybridSearch } from 'maskweaver/memory';
420
+ import { createFeature } from 'maskweaver/context';
421
+ import { MaskLoader } from 'maskweaver/core';
422
+ import { WeaveOrchestrator, GlobalKnowledge } from 'maskweaver/weave';
423
+ ```
424
+
425
+ **Modules:**
426
+ - `maskweaver/core` - Mask loading, validation (YAML/JSON)
427
+ - `maskweaver/memory` - Embeddings + vector search (5 providers)
428
+ - `maskweaver/context` - Feature-based work tracking
429
+ - `maskweaver/verify` - Cross-mask code review
430
+ - `maskweaver/retrospect` - Session effectiveness analysis
431
+ - `maskweaver/weave` - Phase-driven development workflow
432
+ - `maskweaver/gdc` - GDC (Graph-Driven Codebase) integration utilities
433
+ - `maskweaver/plugin` - OpenCode plugin entry point
434
+
435
+ ---
436
+
437
+ ## 🧵 Weave Usage Guide
438
+
439
+ ### Step 0: Initialize (Once)
440
+
441
+ ```bash
442
+ /weave-init
443
+ ```
444
+
445
+ ### Step 1: Create a Plan
446
+
447
+ Generate research + spec + plan in one command:
448
+
449
+ ```bash
450
+ /weave-prepare docs/
451
+ ```
452
+
453
+ Then approve the plan:
454
+
455
+ ```bash
456
+ /weave-approve
457
+ ```
458
+
459
+ The AI will:
460
+ 1. Read all documents in the path
461
+ 2. Search memory for similar past projects
462
+ 3. Ask clarifying questions if needed
463
+ 4. Present a **Phase Plan** for your approval
464
+
465
+ Example output:
466
+ ```markdown
467
+ ## 📋 Execution Plan
468
+
469
+ ### Vision
470
+ Build a modern emotion diary app with AI-powered insights
471
+
472
+ ### Phases
473
+ | Phase | Name | Done When | Est. Time |
474
+ |-------|------|-----------|-----------|
475
+ | P1 | Emotion Selection UI | User can select emotions | 2-3h |
476
+ | P2 | Data Persistence | Emotions saved to storage | 2-3h |
477
+ | P3 | History View | User can view past entries | 2-3h |
478
+
479
+ Is this plan okay? Let me know if changes are needed.
480
+ ```
481
+
482
+ ### Step 2: Approve the Plan (Required)
483
+
484
+ ```bash
485
+ /weave-approve
486
+ ```
487
+
488
+ ### Step 3: Craft a Phase (Auto-select if omitted)
489
+
490
+ Start with the first phase:
491
+
492
+ ```bash
493
+ /weave-craft
494
+ ```
495
+
496
+ `/weave-craft` returns execution context for the phase. Implement changes, then rerun `/weave-craft` if you want to refresh the plan view.
497
+
498
+ ### Step 4: Continue Implementation
499
+
500
+ ```txt
501
+ weave command=craft phaseId="P1"
502
+ weave command=verify
503
+ ```
504
+
505
+ Autonomous build loop:
506
+
507
+ ```txt
508
+ weave command=build action=run phaseIds="P1,P2"
509
+ ```
510
+
511
+ ### Step 5: Finalize the Phase
512
+
513
+ ```txt
514
+ weave command=verify
515
+ weave command=approve
516
+ ```
517
+
518
+ ### Step 6: Handoff & Validate
519
+
520
+ When all verifications pass:
521
+
522
+ ```markdown
523
+ ## ✅ Phase P1 Verification Complete!
524
+
525
+ ### 🤖 AI Test Results
526
+ | Test | Result |
527
+ |------|--------|
528
+ | Build | ✅ Success |
529
+ | Unit Tests | ✅ 15/15 |
530
+ | Lint | ✅ Passed |
531
+
532
+ ### 🎭 Masks Used
533
+ - Kent Beck (testing)
534
+ - Dan Abramov (React components)
535
+
536
+ ### 🔗 Access
537
+ http://localhost:5173
538
+
539
+ ### 👤 Human Validation (Only you can judge)
540
+ - [ ] Does it feel right?
541
+ - [ ] Is the UX good?
542
+ - [ ] Is this what you wanted?
543
+
544
+ **[Approve]** **[Request Changes]** **[Later]**
545
+ ```
546
+
547
+ ### Step 6: Check Status Anytime
548
+
549
+ ```bash
550
+ /weave-status
551
+ ```
552
+
553
+ Output:
554
+ ```markdown
555
+ ## 📊 Weave Progress
556
+
557
+ **Project**: Emotion Diary App
558
+ **Progress**: 40%
559
+
560
+ [████████░░░░░░░░░░░░] 2/5
561
+
562
+ ### Phases
563
+ ✅ **P1**: Emotion Selection UI (2.5h) [kent-beck, dan-abramov]
564
+ 🔄 **P2**: Data Persistence
565
+ ⏳ **P3**: History View
566
+ ⏳ **P4**: Statistics
567
+ ⏳ **P5**: Theme Settings
568
+
569
+ ### Global Knowledge Stats
570
+ - Total troubleshooting records: 47
571
+ - Used in this project: 3
572
+ - Newly recorded: 1
573
+ ```
574
+
575
+ ---
576
+
577
+ ## 🎭 Creating Masks
578
+
579
+ Masks are simple YAML files:
580
+
581
+ ```yaml
582
+ # masks/my-expert.yaml
583
+ metadata:
584
+ id: my-expert
585
+ version: '1.0'
586
+ language: en
587
+
588
+ profile:
589
+ name: Ada Lovelace
590
+ tagline: Pioneer of Computing - First Programmer
591
+
592
+ expertise:
593
+ - Algorithm design
594
+ - Mathematical thinking
595
+ - Analytical engines
596
+
597
+ thinkingStyle: |
598
+ Combines mathematical rigor with poetic imagination.
599
+ Sees patterns others miss.
600
+
601
+ behavior:
602
+ systemPrompt: |
603
+ You are Ada Lovelace, the first computer programmer.
604
+
605
+ You see algorithms as poetry - elegant, precise, beautiful.
606
+ You think in terms of mathematical transformations and
607
+ logical flows.
608
+
609
+ communicationStyle:
610
+ tone: thoughtful
611
+ verbosity: moderate
612
+ technicalDepth: expert
613
+
614
+ usage:
615
+ suitableFor:
616
+ - Algorithm design and optimization
617
+ - Mathematical problem-solving
618
+ - Pattern recognition in code
619
+ ```
620
+
621
+ ---
622
+
623
+ ## 🌍 Multilingual
624
+
625
+ Infrastructure ready for:
626
+ - 🇺🇸 English
627
+ - 🇰🇷 Korean
628
+ - 🇨🇳 Chinese *(coming soon)*
629
+ - 🇯🇵 Japanese *(coming soon)*
630
+
631
+ Masks can have multiple language versions:
632
+ ```
633
+ masks/
634
+ ├── linus-torvalds.en.yaml
635
+ ├── linus-torvalds.ko.yaml
636
+ └── linus-torvalds.zh.yaml
637
+ ```
638
+
639
+ ---
640
+
641
+ ## 🤝 Contributing
642
+
643
+ We need your help!
644
+
645
+ ### Add a Mask
646
+
647
+ Create a YAML file in `masks/` and submit a PR:
648
+ - ✅ Real expertise (domain knowledge)
649
+ - ✅ Distinct personality (thinking style)
650
+ - ✅ Clear use cases (when to use)
651
+ - ✅ Examples (expected behavior)
652
+
653
+ ### Report Bugs
654
+
655
+ Open an issue with:
656
+ 1. What you tried
657
+ 2. What happened
658
+ 3. What you expected
659
+
660
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
661
+
662
+ ---
663
+
664
+ ## 📄 License
665
+
666
+ MIT - See [LICENSE](LICENSE)
667
+
668
+ ---
669
+
670
+ <p align="center">
671
+ <sub>Crafted with 🎭 by <a href="https://github.com/ulgerang">ULJI SOFT</a></sub>
672
+ </p>