thoth-plugin 1.2.1 → 1.2.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.
- package/README.md +16 -0
- package/defaults/AGENTS.md +53 -0
- package/defaults/skill/evening-close/SKILL.md +97 -0
- package/defaults/skill/mail-triage/SKILL.md +26 -0
- package/defaults/skill/morning-boot/SKILL.md +45 -0
- package/defaults/skill/slack-pulse/SKILL.md +26 -0
- package/defaults/skill/thought-router/SKILL.md +89 -0
- package/dist/cli.d.ts +0 -8
- package/dist/cli.js +70 -436
- package/dist/config/index.d.ts +1 -1
- package/dist/config/schema.d.ts +17 -0
- package/dist/defaults/skill/_legacy/cal-grid/SKILL.md +16 -0
- package/dist/defaults/skill/_legacy/capsule-init/SKILL.md +102 -0
- package/dist/defaults/skill/_legacy/cross-linker/SKILL.md +357 -0
- package/dist/defaults/skill/_legacy/email-draft/skill.md +134 -0
- package/dist/defaults/skill/_legacy/gardener/SKILL.md +509 -0
- package/dist/defaults/skill/_legacy/gardener/confidence-tiers.md +142 -0
- package/dist/defaults/skill/_legacy/gardener/repair-workflow.md +170 -0
- package/dist/defaults/skill/_legacy/google-chat-scan/SKILL.md +135 -0
- package/dist/defaults/skill/_legacy/handover/SKILL.md +18 -0
- package/dist/defaults/skill/_legacy/interview-prep/SKILL.md +23 -0
- package/dist/defaults/skill/_legacy/leadership-coach/SKILL.md +167 -0
- package/dist/defaults/skill/_legacy/link-retrofit/SKILL.md +345 -0
- package/dist/defaults/skill/_legacy/onboarding/SKILL.md +207 -0
- package/dist/defaults/skill/_legacy/post-meeting-drill/SKILL.md +485 -0
- package/dist/defaults/skill/_legacy/restore-environment/SKILL.md +30 -0
- package/dist/defaults/skill/_legacy/scorecard-synthesis/SKILL.md +26 -0
- package/dist/defaults/skill/_legacy/skill-generator/SKILL.md +362 -0
- package/dist/defaults/skill/_legacy/skill-generator/testing-protocol.md +158 -0
- package/dist/defaults/skill/_legacy/system-init/SKILL.md +103 -0
- package/dist/defaults/skill/evening-close/SKILL.md +6 -7
- package/dist/defaults/skill/mail-triage/SKILL.md +11 -8
- package/dist/defaults/skill/morning-boot/SKILL.md +26 -87
- package/dist/defaults/skill/slack-pulse/SKILL.md +11 -7
- package/dist/defaults/skill/thought-router/SKILL.md +10 -8
- package/dist/index.js +11316 -2308
- package/dist/schemas/skill.d.ts +96 -0
- package/dist/sdk/index.d.ts +4 -0
- package/dist/sdk/sentinel-service.d.ts +71 -0
- package/dist/sdk/skill-runner.d.ts +21 -0
- package/dist/sdk/thoth-client.d.ts +51 -0
- package/dist/sdk/workflows/calendar-watcher.d.ts +2 -0
- package/dist/sdk/workflows/inbox-watcher.d.ts +2 -0
- package/dist/sdk/workflows/index.d.ts +4 -0
- package/dist/sdk/workflows/system-watcher.d.ts +2 -0
- package/dist/sdk/workflows/task-watcher.d.ts +2 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/skill-registry.d.ts +23 -0
- package/dist/tools/skill/tools.d.ts +2 -1
- package/package.json +8 -3
- /package/{dist/defaults/skill → defaults/skill/_legacy}/cal-grid/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/capsule-init/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/cross-linker/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/email-draft/skill.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/gardener/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/gardener/confidence-tiers.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/gardener/repair-workflow.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/google-chat-scan/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/handover/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/interview-prep/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/leadership-coach/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/link-retrofit/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/onboarding/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/post-meeting-drill/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/restore-environment/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/scorecard-synthesis/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/skill-generator/SKILL.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/skill-generator/testing-protocol.md +0 -0
- /package/{dist/defaults/skill → defaults/skill/_legacy}/system-init/SKILL.md +0 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: capsule-init
|
|
3
|
+
description: Upgrades a project file or folder to a focused Thoth Capsule.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Capsule Init Skill
|
|
7
|
+
|
|
8
|
+
Use this skill when a project grows too complex or when you want to "Deep Dive" into a specific subfolder.
|
|
9
|
+
|
|
10
|
+
## Logic
|
|
11
|
+
|
|
12
|
+
### 1. Target Identification
|
|
13
|
+
Identify if it's a file (`Projects/foo.md`) or a folder (`coding/bar/`).
|
|
14
|
+
|
|
15
|
+
### 2. Location Check
|
|
16
|
+
Determine if the capsule is inside or outside the Thoth repo:
|
|
17
|
+
```bash
|
|
18
|
+
# Get thoth repo root (if inside)
|
|
19
|
+
THOTH_ROOT=$(git -C <target_path> rev-parse --show-toplevel 2>/dev/null)
|
|
20
|
+
|
|
21
|
+
# Check if this is actually the thoth repo (not some other repo)
|
|
22
|
+
# by verifying kernel/ exists
|
|
23
|
+
if [[ -d "$THOTH_ROOT/kernel" ]]; then
|
|
24
|
+
echo "Inside thoth repo"
|
|
25
|
+
else
|
|
26
|
+
echo "Outside thoth repo (or different repo)"
|
|
27
|
+
fi
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### 3. Strategy
|
|
31
|
+
Read the existing content to distill the "Strategic North Star".
|
|
32
|
+
|
|
33
|
+
### 4. Scaffold
|
|
34
|
+
Create the capsule structure:
|
|
35
|
+
|
|
36
|
+
| File | Purpose | When to Create |
|
|
37
|
+
|------|---------|----------------|
|
|
38
|
+
| `AGENTS.md` | Bootloader with persona and context | Always |
|
|
39
|
+
| `CONTEXT.md` | Strategic Interface | Always |
|
|
40
|
+
| `opencode.json` | Instruction Pinning | Always |
|
|
41
|
+
| `.opencode/oh-my-opencode.json` | Plugin config (disables Sisyphus) | **ALWAYS** (symlink if inside, copy if outside) |
|
|
42
|
+
|
|
43
|
+
### 5. Migration
|
|
44
|
+
Move the original project file to `README.md` within the new capsule.
|
|
45
|
+
|
|
46
|
+
## Templates
|
|
47
|
+
|
|
48
|
+
Use templates in `kernel/templates/`:
|
|
49
|
+
- `AGENTS.template.md` — Bootloader structure
|
|
50
|
+
- `CONTEXT.template.md` — Strategic interface
|
|
51
|
+
- `oh-my-opencode.template.json` — Plugin config for external capsules
|
|
52
|
+
|
|
53
|
+
## Plugin Config (CRITICAL - ALWAYS REQUIRED)
|
|
54
|
+
|
|
55
|
+
oh-my-opencode uses `process.cwd()` to find config, NOT git root. Every capsule needs `.opencode/oh-my-opencode.json` accessible from its directory.
|
|
56
|
+
|
|
57
|
+
### Inside Thoth Repo → Create Symlink
|
|
58
|
+
|
|
59
|
+
Calculate the relative path from capsule to root `.opencode/`:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Example: capsule at coding/projects/my-app/
|
|
63
|
+
# Depth = 3 levels from root
|
|
64
|
+
# Symlink target = ../../../.opencode/oh-my-opencode.json
|
|
65
|
+
|
|
66
|
+
# Calculate depth from root
|
|
67
|
+
CAPSULE_PATH="coding/projects/my-app" # relative to thoth root
|
|
68
|
+
DEPTH=$(echo "$CAPSULE_PATH" | tr -cd '/' | wc -c)
|
|
69
|
+
DEPTH=$((DEPTH + 1)) # add 1 for the directory itself
|
|
70
|
+
|
|
71
|
+
# Build relative path (../ repeated DEPTH times)
|
|
72
|
+
REL_PATH=$(printf '../%.0s' $(seq 1 $DEPTH))
|
|
73
|
+
|
|
74
|
+
# Create symlink
|
|
75
|
+
mkdir -p "$CAPSULE_PATH/.opencode"
|
|
76
|
+
cd "$CAPSULE_PATH/.opencode"
|
|
77
|
+
ln -s "${REL_PATH}.opencode/oh-my-opencode.json" oh-my-opencode.json
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
**Quick reference for common depths:**
|
|
81
|
+
|
|
82
|
+
| Capsule Location | Depth | Symlink Target |
|
|
83
|
+
|------------------|-------|----------------|
|
|
84
|
+
| `kernel/` | 1 | `../../.opencode/oh-my-opencode.json` |
|
|
85
|
+
| `work/projects/` | 2 | `../../../.opencode/oh-my-opencode.json` |
|
|
86
|
+
| `coding/projects/my-app/` | 3 | `../../../../.opencode/oh-my-opencode.json` |
|
|
87
|
+
|
|
88
|
+
### Outside Thoth Repo → Copy Template
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
mkdir -p <capsule>/.opencode
|
|
92
|
+
cp kernel/templates/oh-my-opencode.template.json <capsule>/.opencode/oh-my-opencode.json
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Without this config, the capsule will use Sisyphus instead of Thoth.**
|
|
96
|
+
|
|
97
|
+
## Prompt Requirements
|
|
98
|
+
|
|
99
|
+
Ask the user for:
|
|
100
|
+
- Strategic Objective (if not inferable)
|
|
101
|
+
- Persona choice (ARCHITECT, COS, SYSTEM, etc.)
|
|
102
|
+
- Target location (confirm if outside thoth repo)
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cross-linker
|
|
3
|
+
description: Proactive cross-reference discovery. Scans knowledge base for missing [[wikilinks]] using rule-based confidence tiers. Suggests and applies bidirectional links with approval gates.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cross-Linker Skill
|
|
7
|
+
|
|
8
|
+
You are the **Knowledge Base Cross-Linker**. Your role is to discover and create meaningful connections between files that should be linked but aren't.
|
|
9
|
+
|
|
10
|
+
Unlike the Gardener (which fixes broken links), you **proactively find missing links** based on content analysis.
|
|
11
|
+
|
|
12
|
+
## Philosophy
|
|
13
|
+
|
|
14
|
+
> "A link should exist if a reader of file A would benefit from knowing about file B."
|
|
15
|
+
|
|
16
|
+
**Key Principle**: Don't guess. Use evidence. More evidence = higher confidence.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Operating Modes
|
|
21
|
+
|
|
22
|
+
| Mode | Command | Action | Writes |
|
|
23
|
+
|------|---------|--------|--------|
|
|
24
|
+
| **Scan** | `/cross-linker` or `/cross-linker scan` | Discover and report suggestions | No |
|
|
25
|
+
| **Scan Subset** | `/cross-linker scan <path>` | Scan specific folder only | No |
|
|
26
|
+
| **Apply** | `/cross-linker apply` | Apply approved suggestions | Yes |
|
|
27
|
+
| **Single File** | `/cross-linker file <path>` | Find links for one file | No |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Confidence Tiers
|
|
32
|
+
|
|
33
|
+
**DO NOT estimate confidence as a number.** Instead, count evidence signals.
|
|
34
|
+
|
|
35
|
+
| Tier | Evidence Required | Action |
|
|
36
|
+
|------|-------------------|--------|
|
|
37
|
+
| **CERTAIN** (99%) | Explicit name match in content | Auto-suggest, recommend apply |
|
|
38
|
+
| **STRONG** (90%) | 2+ signals from the checklist | Suggest with review |
|
|
39
|
+
| **MEDIUM** (70%) | 1 signal from the checklist | List for consideration |
|
|
40
|
+
| **WEAK** (<50%) | Semantic similarity only | Ignore (too risky) |
|
|
41
|
+
|
|
42
|
+
### Evidence Checklist
|
|
43
|
+
|
|
44
|
+
For each potential link from File A → File B, check these boxes:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
□ EXPLICIT_MENTION: File A contains the exact title/name of File B
|
|
48
|
+
□ RELATED_FRONTMATTER: File A's `related:` field mentions File B (but no [[link]])
|
|
49
|
+
□ SHARED_TAGS: Files share ≥2 tags in frontmatter
|
|
50
|
+
□ SAME_PROJECT: Files are in the same project folder
|
|
51
|
+
□ RECIPROCAL_MISSING: File B links to A, but A doesn't link to B
|
|
52
|
+
□ PERSON_MENTION: File A mentions a person name that matches a person file
|
|
53
|
+
□ PROJECT_MENTION: File A mentions a project name that matches a project file
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Scoring:**
|
|
57
|
+
- EXPLICIT_MENTION alone = CERTAIN
|
|
58
|
+
- RECIPROCAL_MISSING alone = CERTAIN
|
|
59
|
+
- RELATED_FRONTMATTER alone = STRONG
|
|
60
|
+
- 2+ other signals = STRONG
|
|
61
|
+
- 1 signal = MEDIUM
|
|
62
|
+
- 0 signals = WEAK (ignore)
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Mode 1: Full Scan
|
|
67
|
+
|
|
68
|
+
### Step 1: Build File Index
|
|
69
|
+
|
|
70
|
+
For each `.md` file in the knowledge base, extract:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
file: "work/people/john-smith.md"
|
|
74
|
+
title: "John Smith" # From H1 or filename
|
|
75
|
+
aliases: ["John", "JS"] # Common variations
|
|
76
|
+
tags: ["engineering", "team-lead"] # From frontmatter
|
|
77
|
+
related: ["work/projects/apollo.md"] # From frontmatter
|
|
78
|
+
existing_links: ["[[jane-doe]]", ...] # Already linked
|
|
79
|
+
parent_folder: "work/people/" # Context
|
|
80
|
+
summary: "Engineering lead for..." # First 100 chars or frontmatter summary
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
**Skip these files:**
|
|
84
|
+
- Files in `Archive/`, `templates/`, `tmp/`
|
|
85
|
+
- Files matching `TEMPLATE-*`
|
|
86
|
+
- Non-hemisphere files (root level)
|
|
87
|
+
|
|
88
|
+
### Step 2: Build Entity Registry
|
|
89
|
+
|
|
90
|
+
Create lookup tables for fast matching:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
PEOPLE: {
|
|
94
|
+
"john smith" → "work/people/john-smith.md",
|
|
95
|
+
"john" → "work/people/john-smith.md", // if unambiguous
|
|
96
|
+
"jane doe" → "work/people/jane-doe.md",
|
|
97
|
+
...
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
PROJECTS: {
|
|
101
|
+
"apollo" → "work/projects/apollo/",
|
|
102
|
+
"project apollo" → "work/projects/apollo/",
|
|
103
|
+
...
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
TAGS: {
|
|
107
|
+
"hiring" → ["work/people/john.md", "work/projects/recruiting.md", ...],
|
|
108
|
+
...
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Step 3: Scan for Missing Links
|
|
113
|
+
|
|
114
|
+
For each file, check:
|
|
115
|
+
|
|
116
|
+
1. **Explicit Mentions**: Does the content contain any entity from the registry that isn't already linked?
|
|
117
|
+
2. **Related Field**: Does `related:` reference files without `[[wikilinks]]` in the body?
|
|
118
|
+
3. **Reciprocal Links**: Do any files link TO this file without a return link?
|
|
119
|
+
4. **Tag Clusters**: Are there files with 2+ shared tags that aren't linked?
|
|
120
|
+
5. **Folder Siblings**: Are there unlinked files in the same project folder?
|
|
121
|
+
|
|
122
|
+
### Step 4: Score and Tier
|
|
123
|
+
|
|
124
|
+
For each candidate link, count evidence signals and assign tier.
|
|
125
|
+
|
|
126
|
+
### Step 5: Generate Report
|
|
127
|
+
|
|
128
|
+
Output a structured report:
|
|
129
|
+
|
|
130
|
+
```markdown
|
|
131
|
+
## Cross-Reference Scan Report
|
|
132
|
+
|
|
133
|
+
**Scanned**: {timestamp}
|
|
134
|
+
**Files Analyzed**: {count}
|
|
135
|
+
**Suggestions Found**: {count}
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
### CERTAIN (Auto-Apply Recommended)
|
|
140
|
+
|
|
141
|
+
These have explicit evidence and are safe to apply:
|
|
142
|
+
|
|
143
|
+
| Source | Target | Evidence |
|
|
144
|
+
|--------|--------|----------|
|
|
145
|
+
| `work/notes/meeting-2024-01.md` | `[[john-smith]]` | Name "John Smith" appears on line 12 |
|
|
146
|
+
| `work/projects/apollo/status.md` | `[[jane-doe]]` | Reciprocal: jane-doe.md links here |
|
|
147
|
+
|
|
148
|
+
**Apply all CERTAIN links?** (12 links) [Awaiting approval]
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
### STRONG (Review Recommended)
|
|
153
|
+
|
|
154
|
+
These have multiple signals but should be verified:
|
|
155
|
+
|
|
156
|
+
| Source | Target | Evidence |
|
|
157
|
+
|--------|--------|----------|
|
|
158
|
+
| `work/projects/hiring.md` | `[[recruiting-process]]` | Shared tags: hiring, process; Same folder |
|
|
159
|
+
|
|
160
|
+
**Review STRONG links?** (8 links) [Awaiting approval]
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### MEDIUM (Optional)
|
|
165
|
+
|
|
166
|
+
Single-signal matches. Apply only if you recognize the connection:
|
|
167
|
+
|
|
168
|
+
| Source | Target | Evidence |
|
|
169
|
+
|--------|--------|----------|
|
|
170
|
+
| `life/health/fitness.md` | `[[nutrition]]` | Shared tag: health |
|
|
171
|
+
|
|
172
|
+
**Show MEDIUM links?** (23 links) [Default: skip]
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
### Statistics
|
|
177
|
+
|
|
178
|
+
| Tier | Count | Recommended Action |
|
|
179
|
+
|------|-------|-------------------|
|
|
180
|
+
| CERTAIN | 12 | Apply |
|
|
181
|
+
| STRONG | 8 | Review |
|
|
182
|
+
| MEDIUM | 23 | Skip |
|
|
183
|
+
| WEAK | 47 | Ignored |
|
|
184
|
+
|
|
185
|
+
### Files with Most Missing Links
|
|
186
|
+
1. `work/notes/meeting-2024-01.md` - 5 suggestions
|
|
187
|
+
2. `work/projects/apollo/readme.md` - 4 suggestions
|
|
188
|
+
3. ...
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Mode 2: Scan Subset
|
|
194
|
+
|
|
195
|
+
Same as Mode 1, but scoped to a specific path:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
/cross-linker scan work/people/
|
|
199
|
+
/cross-linker scan work/projects/apollo/
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Useful for:
|
|
203
|
+
- Testing the skill on a small set first
|
|
204
|
+
- Focusing on a specific area after adding new files
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Mode 3: Apply Links
|
|
209
|
+
|
|
210
|
+
### Pre-Requisites
|
|
211
|
+
|
|
212
|
+
1. A scan must have been run in this session
|
|
213
|
+
2. User must approve which tiers to apply
|
|
214
|
+
|
|
215
|
+
### Approval Flow
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
You: "Apply all CERTAIN links? (12 links)"
|
|
219
|
+
User: "yes"
|
|
220
|
+
You: [Apply 12 links]
|
|
221
|
+
|
|
222
|
+
You: "Review STRONG links? (8 links)"
|
|
223
|
+
User: "show me"
|
|
224
|
+
You: [Show detailed list with context]
|
|
225
|
+
User: "apply 1, 3, 5, skip rest"
|
|
226
|
+
You: [Apply selected links]
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Link Insertion Protocol
|
|
230
|
+
|
|
231
|
+
When adding a `[[wikilink]]`:
|
|
232
|
+
|
|
233
|
+
1. **Find the right location** in the source file:
|
|
234
|
+
- If mentioning a person/project by name → replace the name with `[[link|name]]`
|
|
235
|
+
- If no natural location → add to a "Related" section at the bottom
|
|
236
|
+
|
|
237
|
+
2. **Make it bidirectional** (if not already):
|
|
238
|
+
- Check if target file links back
|
|
239
|
+
- If not, add a "Referenced by" or "Related" section to target
|
|
240
|
+
|
|
241
|
+
3. **Preserve formatting**:
|
|
242
|
+
- Don't break existing sentences
|
|
243
|
+
- Use aliases when the link text differs from filename: `[[john-smith|John]]`
|
|
244
|
+
|
|
245
|
+
### Example Transformations
|
|
246
|
+
|
|
247
|
+
**Before (source file):**
|
|
248
|
+
```markdown
|
|
249
|
+
Met with John Smith to discuss the Apollo project timeline.
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**After:**
|
|
253
|
+
```markdown
|
|
254
|
+
Met with [[john-smith|John Smith]] to discuss the [[apollo|Apollo]] project timeline.
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Target file (john-smith.md) - add if missing:**
|
|
258
|
+
```markdown
|
|
259
|
+
## Referenced By
|
|
260
|
+
- [[meeting-2024-01]] - Meeting notes mentioning this person
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Mode 4: Single File
|
|
266
|
+
|
|
267
|
+
Analyze one file and suggest links:
|
|
268
|
+
|
|
269
|
+
```
|
|
270
|
+
/cross-linker file work/notes/new-meeting.md
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
Useful for:
|
|
274
|
+
- Just created a new file, want to connect it
|
|
275
|
+
- Checking a specific file's link coverage
|
|
276
|
+
|
|
277
|
+
### Output
|
|
278
|
+
|
|
279
|
+
```markdown
|
|
280
|
+
## Link Suggestions for: work/notes/new-meeting.md
|
|
281
|
+
|
|
282
|
+
### Found Entities
|
|
283
|
+
- "John Smith" (line 5) → [[john-smith]] ✓ CERTAIN
|
|
284
|
+
- "Apollo" (line 8) → [[apollo]] ✓ CERTAIN
|
|
285
|
+
- "hiring" (tag) → [[recruiting-process]] ? MEDIUM
|
|
286
|
+
|
|
287
|
+
### Missing Reciprocal Links
|
|
288
|
+
- [[jane-doe]] links to this file's folder but not this file
|
|
289
|
+
|
|
290
|
+
### Suggested Actions
|
|
291
|
+
1. Add [[john-smith|John Smith]] on line 5
|
|
292
|
+
2. Add [[apollo|Apollo]] on line 8
|
|
293
|
+
3. Consider linking to [[recruiting-process]] (shared tag)
|
|
294
|
+
|
|
295
|
+
**Apply suggestions?** [Awaiting approval]
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
---
|
|
299
|
+
|
|
300
|
+
## Technical Constraints
|
|
301
|
+
|
|
302
|
+
### Safety Rules
|
|
303
|
+
|
|
304
|
+
1. **NEVER create links without evidence** - No "vibes-based" linking
|
|
305
|
+
2. **NEVER modify content meaning** - Only add links, don't rewrite sentences
|
|
306
|
+
3. **ALWAYS preserve existing links** - Don't duplicate or override
|
|
307
|
+
4. **ALWAYS use aliases** when link text differs from filename
|
|
308
|
+
5. **BATCH operations require approval** - No silent mass changes
|
|
309
|
+
|
|
310
|
+
### Entity Matching Rules
|
|
311
|
+
|
|
312
|
+
**Person names:**
|
|
313
|
+
- Match full name: "John Smith" → `john-smith.md`
|
|
314
|
+
- Match first name ONLY if unambiguous (only one John in KB)
|
|
315
|
+
- Case-insensitive matching
|
|
316
|
+
- Handle common variations: "John" / "John Smith" / "J. Smith"
|
|
317
|
+
|
|
318
|
+
**Project names:**
|
|
319
|
+
- Match folder name or title
|
|
320
|
+
- Match common abbreviations if defined in frontmatter aliases
|
|
321
|
+
|
|
322
|
+
**Avoid false positives:**
|
|
323
|
+
- Common words that happen to match file names (e.g., "life" matching `life/`)
|
|
324
|
+
- Partial matches (e.g., "Apollo 11" shouldn't match `apollo/` if it's about space)
|
|
325
|
+
|
|
326
|
+
### Performance
|
|
327
|
+
|
|
328
|
+
For large knowledge bases (500+ files):
|
|
329
|
+
- Process in batches by hemisphere
|
|
330
|
+
- Cache the entity registry between runs
|
|
331
|
+
- Skip unchanged files (check mtime)
|
|
332
|
+
|
|
333
|
+
---
|
|
334
|
+
|
|
335
|
+
## Integration with Gardener
|
|
336
|
+
|
|
337
|
+
The Cross-Linker complements the Gardener:
|
|
338
|
+
|
|
339
|
+
| Gardener | Cross-Linker |
|
|
340
|
+
|----------|--------------|
|
|
341
|
+
| Fixes broken links | Creates missing links |
|
|
342
|
+
| Reactive (finds problems) | Proactive (finds opportunities) |
|
|
343
|
+
| Deterministic rules | Evidence-based suggestions |
|
|
344
|
+
| Run after migrations | Run after adding content |
|
|
345
|
+
|
|
346
|
+
**Recommended workflow:**
|
|
347
|
+
1. Create new content
|
|
348
|
+
2. Run `/cross-linker file <new-file>` to connect it
|
|
349
|
+
3. Periodically run `/cross-linker scan` for full coverage
|
|
350
|
+
4. Run `/gardener check` to verify no broken links
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Example Session
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
User: /cross-linker scan work/
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: email-draft
|
|
3
|
+
description: Use when drafting emails, composing replies, or writing professional messages that will be sent via Gmail.
|
|
4
|
+
triggers:
|
|
5
|
+
- draft email
|
|
6
|
+
- draft a reply
|
|
7
|
+
- write an email
|
|
8
|
+
- respond to email
|
|
9
|
+
- compose email
|
|
10
|
+
- reply to this email
|
|
11
|
+
- help me write an email
|
|
12
|
+
- email response
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Email Draft
|
|
16
|
+
|
|
17
|
+
**Core principle:** Gmail does not support Markdown. Always use HTML formatting with `body_format="html"`.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## When to Use
|
|
22
|
+
|
|
23
|
+
- Drafting a reply to an email
|
|
24
|
+
- Composing a new email
|
|
25
|
+
- Writing professional messages via Gmail
|
|
26
|
+
|
|
27
|
+
**Do NOT use when:**
|
|
28
|
+
- Sending Slack messages (different formatting)
|
|
29
|
+
- Writing internal KB notes (Markdown is fine)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Quick Reference
|
|
34
|
+
|
|
35
|
+
| Task | Command/Action |
|
|
36
|
+
|------|----------------|
|
|
37
|
+
| Bold text | `<b>text</b>` |
|
|
38
|
+
| Italic text | `<i>text</i>` |
|
|
39
|
+
| Line break | `<br>` |
|
|
40
|
+
| Paragraph | `<p>text</p>` |
|
|
41
|
+
| Bullet list | `<ul><li>item</li></ul>` |
|
|
42
|
+
| Numbered list | `<ol><li>item</li></ol>` |
|
|
43
|
+
| Create draft | `google-workspace_draft_gmail_message` with `body_format="html"` |
|
|
44
|
+
| Send email | `google-workspace_send_gmail_message` with `body_format="html"` |
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Process
|
|
49
|
+
|
|
50
|
+
### 1. Gather Context
|
|
51
|
+
|
|
52
|
+
**For replies:**
|
|
53
|
+
- Retrieve thread with `get_gmail_thread_content(thread_id, user_google_email)`
|
|
54
|
+
- Extract `thread_id` and `in_reply_to` (Message-ID header)
|
|
55
|
+
- Note key points requiring response
|
|
56
|
+
|
|
57
|
+
**For new emails:**
|
|
58
|
+
- Confirm recipient and purpose
|
|
59
|
+
- Check stakeholder file if available (`work/Stakeholders/` or `work/Team/`)
|
|
60
|
+
|
|
61
|
+
### 2. Draft Content
|
|
62
|
+
|
|
63
|
+
Structure:
|
|
64
|
+
1. **Opening** — Acknowledge their message (replies) or state purpose (new)
|
|
65
|
+
2. **Body** — Key points with `<b>headers</b>` for multiple topics
|
|
66
|
+
3. **Closing** — Next steps or call to action
|
|
67
|
+
4. **Sign-off** — "Best, David"
|
|
68
|
+
|
|
69
|
+
Format with HTML:
|
|
70
|
+
- `<b>` for section headers
|
|
71
|
+
- `<ul><li>` for lists of 3+ items
|
|
72
|
+
- `<p>` for paragraph separation
|
|
73
|
+
- `<i>` sparingly for emphasis
|
|
74
|
+
|
|
75
|
+
### 3. Present for Approval
|
|
76
|
+
|
|
77
|
+
Show full email in chat before saving:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
**Draft ready for review:**
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
[Email content]
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
**To:** recipient
|
|
87
|
+
**CC:** if applicable
|
|
88
|
+
|
|
89
|
+
Shall I save as draft?
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 4. Save Draft
|
|
93
|
+
|
|
94
|
+
```python
|
|
95
|
+
google-workspace_draft_gmail_message(
|
|
96
|
+
user_google_email="david.helmus@hellofresh.com",
|
|
97
|
+
to="recipient@example.com",
|
|
98
|
+
subject="Re: Subject",
|
|
99
|
+
body="<p>HTML content</p>",
|
|
100
|
+
body_format="html", # CRITICAL
|
|
101
|
+
thread_id="...", # For replies
|
|
102
|
+
in_reply_to="<message-id>" # For replies
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Common Mistakes
|
|
109
|
+
|
|
110
|
+
| Mistake | Prevention |
|
|
111
|
+
|---------|------------|
|
|
112
|
+
| Using Markdown `**bold**` | Use HTML `<b>bold</b>` — Gmail renders Markdown literally |
|
|
113
|
+
| Forgetting `body_format="html"` | Always include — defaults to plain text |
|
|
114
|
+
| Missing `thread_id` on replies | Retrieve from original message first |
|
|
115
|
+
| Sending without approval | Always draft first, ask Zeus to confirm |
|
|
116
|
+
| Using personal email for work | Work context = `david.helmus@hellofresh.com` |
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Red Flags - STOP
|
|
121
|
+
|
|
122
|
+
- About to use `**` or `__` for formatting — STOP, use HTML
|
|
123
|
+
- About to send without Zeus approval — STOP, save as draft
|
|
124
|
+
- Can't find thread_id for a reply — STOP, retrieve original thread first
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Verification Checklist
|
|
129
|
+
|
|
130
|
+
- [ ] Used HTML tags, not Markdown
|
|
131
|
+
- [ ] Included `body_format="html"` parameter
|
|
132
|
+
- [ ] For replies: included `thread_id` and `in_reply_to`
|
|
133
|
+
- [ ] Presented draft to Zeus before saving
|
|
134
|
+
- [ ] Used correct email (work vs personal context)
|