@bojackduy/opencode-learn 0.1.0
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/CHANGELOG.md +10 -0
- package/LICENSE +25 -0
- package/README.md +151 -0
- package/agents/mermaid-maker.md +61 -0
- package/agents/researcher.md +53 -0
- package/agents/svg-maker.md +65 -0
- package/commands/md_log.md +5 -0
- package/commands/md_unlog.md +5 -0
- package/dist/server.js +1181 -0
- package/dist/tui.js +1528 -0
- package/package.json +92 -0
- package/plugins/learn-tui.tsx +548 -0
- package/plugins/learn.ts +991 -0
- package/scripts/build-tui.ts +20 -0
- package/scripts/install.mjs +250 -0
- package/skills/marker-pdf-parser/README.md +38 -0
- package/skills/marker-pdf-parser/SKILL.md +130 -0
- package/skills/marker-pdf-parser/requirements.txt +1 -0
- package/skills/marker-pdf-parser/scripts/parse_pdf.py +150 -0
- package/skills/notebooklm-lecture-notes/SKILL.md +173 -0
- package/skills/notebooklm-lecture-notes/references/prompts.md +40 -0
- package/skills/teach/SKILL.md +150 -0
- package/skills/visualize/SKILL.md +82 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0 — 2026-08-31
|
|
4
|
+
|
|
5
|
+
* Initial port of `amosblomqvist/learn` (`pi` extensions: `quiz`, `md-log`, `visual-tools` + `teach`/`visualize` skills + `researcher`/`mermaid-maker`/`svg-maker` agents) to OpenCode `learn` + `learn-tui` plugins.
|
|
6
|
+
* `quiz`/`quiz_batch` — graded, shuffled, `I don't know` + `note`, durable `pendingDir` `.opencode/learn-pending`, 4-state `hit/miss/false-alarm/correct-rejection` solid `bg` inverted.
|
|
7
|
+
* `md_log`/`md_unlog` — `> [!quote] YOU` / `> [!abstract] OPENCODE` + `> [!question|success|failure]` callouts, LaTeX, backfill `client.session.messages`, `chat.message`/`experimental.text.complete`/`tool.execute`.
|
|
8
|
+
* `write_mermaid`/`edit`/`render` + `write_svg`/`edit`/`render` — `opencode-visual-tools` staging, `viz/` publish, `Chrome`/`mmdc` / `rsvg-convert`→`magick`.
|
|
9
|
+
* Installer `npx @bojackduy/opencode-learn` — idempotent `opencode.jsonc`/`tui.json` `plugin` array, `agents/`, `skills/`, `commands/` copy, `OPENCODE_CONFIG_DIR` override, `--uninstall`.
|
|
10
|
+
* Honours original authors: Mario Zechner (`pi`) + Amos Blomqvist (`learn`, video).
|
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Duy Trinh — Port of amosblomqvist/learn and Mario Zechner's pi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
Original pi: Copyright (c) Mario Zechner — https://github.com/mariozechner/pi
|
|
24
|
+
Original learn: Copyright (c) Amos Blomqvist — https://github.com/amosblomqvist/learn
|
|
25
|
+
Video: How I Use AI to Learn Things — https://www.youtube.com/watch?v=kzcI5F4tGiU
|
package/README.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# opencode-learn
|
|
2
|
+
|
|
3
|
+
**Pi `learn` system for OpenCode — teaching that locks in, not just delivers.**
|
|
4
|
+
|
|
5
|
+
> Port of the [`pi` learn harness](https://github.com/amosblomqvist/learn) to [OpenCode](https://opencode.ai). Original system by [**Amos Blomqvist**](https://github.com/amosblomqvist) from [**How I Use AI to Learn Things**](https://www.youtube.com/watch?v=kzcI5F4tGiU) (thumbnail: `pi` by [**Mario Zechner**](https://github.com/mariozechner/pi) / [`earendil-works/pi`](https://github.com/earendil-works/pi)).
|
|
6
|
+
|
|
7
|
+
[](https://opencode.ai)
|
|
8
|
+
[](https://github.com/anomalyco/opentui)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
|
|
11
|
+
## Why
|
|
12
|
+
|
|
13
|
+
Two brains can hold the same facts — one as disconnected lone facts, the other as a dependency graph where every fact is derivable from a few core truths. Teaching here builds that graph: **nodes** (unconditional truths) → **edges** (motivated discovery, 3Blue1Brown-style `how could I have discovered this?`).
|
|
14
|
+
|
|
15
|
+
* **Probe → Plan → Teach** — every session locates your edge (graded `quiz` probes), scopes goal (native `question`), plans DAG, then teaches node-by-node with `quiz`-check.
|
|
16
|
+
* **Verifies, not hallucinates** — `researcher` subagent (`task` `subagent_type=researcher`) before any shaky claim.
|
|
17
|
+
* **Logs to Obsidian** — `md_log` mirrors `YOU`/`OPENCODE`/`Quiz`/`Question` as `> [!quote]`/`> [!abstract]`/`> [!question|success|failure]` callouts, LaTeX `$…$` rendered in Obsidian. `viz/` PNGs embed as `![[viz-*.png|500]]`.
|
|
18
|
+
|
|
19
|
+
Keywords: `opencode` `opencode-plugin` `learn` `teach` `quiz` `md-log` `obsidian` `3blue1brown` `socratic`
|
|
20
|
+
|
|
21
|
+
## What's inside
|
|
22
|
+
|
|
23
|
+
| Pi original `amosblomqvist/learn` | Opencode port `personal/.opencode` | Notes |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `skills/teach/SKILL.md` | `skills/teach/SKILL.md` | `quiz` + native `question` (custom `ask` removed to cut hallucination, `question` is single source), `task researcher` |
|
|
26
|
+
| `skills/visualize/SKILL.md` | `skills/visualize/SKILL.md` | `task subagent_type=mermaid-maker/svg-maker` + `![[filename|500]]` |
|
|
27
|
+
| `extensions/quiz` | `plugins/learn.ts:quiz` + `quiz_batch` | Graded `single|multi` + `I don't know` + `note`, shuffled, `correctAnswer` by value, TUI durable `pendingDir` `opencode-visual-tools` |
|
|
28
|
+
| `extensions/ask-user-question` | **removed** — use native `question` | One less tool → less overhead/hallucination |
|
|
29
|
+
| `extensions/md-log` | `plugins/learn.ts:md_log/md_unlog` `opencode.json:md_log` | `> [!quote] YOU` / `> [!abstract] OPENCODE` + backfill `client.session.messages` + `chat.message`/`experimental.text.complete`/`tool.execute` |
|
|
30
|
+
| `extensions/visual-tools` `mermaid/svg` | `plugins/learn.ts:write_mermaid/edit/render` + `write_svg/edit/render` | `STAGING_ROOT=tmp/opencode-visual-tools`, `Chrome`+`mmdc` / `rsvg-convert`→`magick`, `viz/` publish |
|
|
31
|
+
| `agents/researcher` `mermaid-maker` `svg-maker` | `agents/{researcher,mermaid-maker,svg-maker}.md` | `researcher` `safe_bash` → `bash:ask` in opencode; makers get `write_*`/`render_*` at **primary** (`* :allow`) per user choice |
|
|
32
|
+
|
|
33
|
+
Plus `plugins/learn-tui.tsx` — modal TUI `QuizDialog`/`QuizBatchDialog` (4-state `hit/miss/false-alarm/correct-rejection` `success/error/warning` solid `bg` inverted, `0a/15` lighter, `○/✓/✗`), durable `pendingDir` `.opencode/learn-pending` `watch+poll 700ms` + `hb 2s` `.tui-alive`.
|
|
34
|
+
|
|
35
|
+
## Honour & reference
|
|
36
|
+
|
|
37
|
+
* **Pi** — [Mario Zechner — `pi` coding agent](https://github.com/mariozechner/pi) / [`earendil-works/pi`](https://github.com/earendil-works/pi) — the runtime this port targets away from.
|
|
38
|
+
* **Learn system** — [Amos Blomqvist — `amosblomqvist/learn`](https://github.com/amosblomqvist/learn) — the teaching philosophy (unconditional truths, `how could I have discovered this?`) and the `quiz`/`ask`/`md-log`/`visual-tools` harness. This port keeps the `probe→plan→teach` DAG and `researcher` verification verbatim.
|
|
39
|
+
* **Video** — [How I Use AI to Learn Things](https://www.youtube.com/watch?v=kzcI5F4tGiU) (`assets/thumbnail.png` in original) — watch first.
|
|
40
|
+
|
|
41
|
+
> This is a personal port, shared as-is. Original `learn` is for one learner (Amos) — edit `skills/teach/SKILL.md` to fit you.
|
|
42
|
+
|
|
43
|
+
## Install
|
|
44
|
+
|
|
45
|
+
### Plugin — simple (no installer)
|
|
46
|
+
|
|
47
|
+
Add to **both** configs (opencode needs server + TUI):
|
|
48
|
+
|
|
49
|
+
**`~/.config/opencode/opencode.jsonc`** — server (`learn` + visual):
|
|
50
|
+
```jsonc
|
|
51
|
+
{ "plugin": ["@bojackduy/opencode-learn"] }
|
|
52
|
+
```
|
|
53
|
+
**`~/.config/opencode/tui.json`** — TUI (`learn-tui`):
|
|
54
|
+
```jsonc
|
|
55
|
+
{ "plugin": ["@bojackduy/opencode-learn/tui"] }
|
|
56
|
+
```
|
|
57
|
+
Restart OpenCode. Verify `/md_log`, `quiz`, `write_mermaid` appear in tool list.
|
|
58
|
+
|
|
59
|
+
Local checkout:
|
|
60
|
+
```jsonc
|
|
61
|
+
// opencode.jsonc
|
|
62
|
+
{ "plugin": ["./path/to/personal/.opencode"] }
|
|
63
|
+
// tui.json
|
|
64
|
+
{ "plugin": ["./path/to/personal/.opencode/plugins/learn-tui.tsx"] }
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Installer — skills + agents + plugins in one command
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npx -y @bojackduy/opencode-learn@latest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Installs:
|
|
74
|
+
* `plugin` → `opencode.jsonc`/`tui.json` (package spec `@bojackduy/opencode-learn@<version>`)
|
|
75
|
+
* `agents/` → `~/.config/opencode/agents/{researcher,mermaid-maker,svg-maker}.md`
|
|
76
|
+
* `skills/` → `~/.config/opencode/skills/{teach,visualize}/SKILL.md` + `marker-pdf-parser`/`notebooklm-lecture-notes`
|
|
77
|
+
* `commands/` → `~/.config/opencode/commands/{md_log,md_unlog}.md` (if present)
|
|
78
|
+
|
|
79
|
+
Re-run to update. Then **restart OpenCode**.
|
|
80
|
+
|
|
81
|
+
Uninstall:
|
|
82
|
+
```bash
|
|
83
|
+
npx -y @bojackduy/opencode-learn@latest --uninstall
|
|
84
|
+
```
|
|
85
|
+
Or global:
|
|
86
|
+
```bash
|
|
87
|
+
npm i -g @bojackduy/opencode-learn@latest
|
|
88
|
+
opencode-learn # install
|
|
89
|
+
opencode-learn --uninstall # remove
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Manual
|
|
93
|
+
|
|
94
|
+
Copy `plugins/`, `agents/`, `skills/teach`, `skills/visualize` into `~/.config/opencode/` and add `plugin` entries above.
|
|
95
|
+
|
|
96
|
+
## Usage
|
|
97
|
+
|
|
98
|
+
**Mirror to Obsidian**
|
|
99
|
+
```
|
|
100
|
+
/md_log /path/to/note.md # file must exist — backfills history, mirrors YOU/OPENCODE/Quiz as callouts, LaTeX $…$
|
|
101
|
+
/md_unlog
|
|
102
|
+
```
|
|
103
|
+
View in Obsidian — `viz/` PNGs embed as `![[viz-*.png|500]]`, mermaid `$$…$$`.
|
|
104
|
+
|
|
105
|
+
**Quiz — probe & check**
|
|
106
|
+
```
|
|
107
|
+
quiz(question="What is 2+2?", options=[{label:"3"}, {label:"4"}], correctAnswer="4", explanation="…")
|
|
108
|
+
quiz_batch(quizzes=[{question:"…", options:[…], correctAnswer:["Red","Blue"], explanation:"…", multiSelect:true}])
|
|
109
|
+
```
|
|
110
|
+
Single → TUI popup `QuizDialog` (single/multi + `I don't know` + note). Batch → deck `1/3→3/3` `QuizBatchDialog` (same 4-state `hit/miss/false-alarm/correct-rejection` solid `bg` inverted). Both durable `pendingDir` `.opencode/learn-pending` — kill `opencode` mid-popup → re-show on restart.
|
|
111
|
+
|
|
112
|
+
Open forks: native `question` (single/multi `Other`).
|
|
113
|
+
|
|
114
|
+
**Visual — one correct picture**
|
|
115
|
+
```
|
|
116
|
+
task(subagent_type="mermaid-maker", prompt="graph TD: packet → ordering → reliable stream, 3 nodes only")
|
|
117
|
+
# → returns filename: viz-packet-*.png → embed ![[viz-*.png|500]] (md_log mirrors)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Publishing (template from `@bojackduy/opencode-loopd`)
|
|
121
|
+
|
|
122
|
+
This harness follows `opencode-loopd`'s npm + installer template (`~/Code/opencode-loopd`):
|
|
123
|
+
|
|
124
|
+
* `package.json` — `name:@bojackduy/opencode-learn` `version` `bin:opencode-learn=scripts/install-node.mjs` `files:[plugins,agents,skills,commands,dist]` `publishConfig access public` `peerDependencies @opencode-ai/plugin`
|
|
125
|
+
* `scripts/install-node.mjs` — idempotent `opencode.jsonc`/`tui.json` `plugin` array rewrite (keeps comments, `formatPluginArray`), `OPENCODE_CONFIG_DIR` override, `commands/*.md` + `skills/*` copy, `--uninstall` purge, `ensureDependency` `@opencode-ai/plugin`.
|
|
126
|
+
* `tsconfig.json` + `bun build` → `dist/` for `tui` (solid) if needed, `prepack: bun run typecheck && bun test && bun run build`.
|
|
127
|
+
|
|
128
|
+
Release:
|
|
129
|
+
```bash
|
|
130
|
+
bun run typecheck && bun test && bun run build
|
|
131
|
+
npm version patch -m "chore: release %s" && git push && git push --tags
|
|
132
|
+
# GH Action .github/workflows/npm-publish.yml on v*.*.* → npm publish --access public + gh release
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
See `~/Code/opencode-loopd/{package.json,scripts/install-node.mjs,.github/workflows/npm-publish.yml,README.md#Install}` as template.
|
|
136
|
+
|
|
137
|
+
## Requirements
|
|
138
|
+
|
|
139
|
+
* [OpenCode](https://opencode.ai) `>=1.18` + `bun >=1.1`
|
|
140
|
+
* `ask-user-question` not needed — native `question` used
|
|
141
|
+
* Visual: `Chrome` (`/Applications/Google Chrome.app/...`) + `@mermaid-js/mermaid-cli` (bundled) or `rsvg-convert`/`magick` for SVG. `viz/` inside vault.
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT — see `LICENSE`. Original `learn` is personal, shared as-is by Amos.
|
|
146
|
+
|
|
147
|
+
## Credits
|
|
148
|
+
|
|
149
|
+
* **Mario Zechner** — `pi` agent, TUI, extension API
|
|
150
|
+
* **Amos Blomqvist** — `learn` teaching system, `quiz`/`md-log`/`visual-tools`, video + repo
|
|
151
|
+
* Port to OpenCode — `personal/.opencode` `learn`+`learn-tui` (visual `STAGING_ROOT` `opencode-visual-tools`, `OPENCODE` block, `question` dedup, `quiz_batch` beautiful `Quiz i/N`)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Authors ONE Mermaid diagram from a brief, renders it to a PNG, LOOKS at the result, iterates until it is correct and clean, publishes the PNG into the vault
|
|
3
|
+
mode: subagent
|
|
4
|
+
permission:
|
|
5
|
+
bash: allow
|
|
6
|
+
read: allow
|
|
7
|
+
write: allow
|
|
8
|
+
edit: allow
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Mermaid Maker
|
|
12
|
+
|
|
13
|
+
You are a **diagram author + renderer**. You receive a brief describing ONE idea to visualize as a Mermaid diagram, and you return ONE clean, correct PNG published into the vault.
|
|
14
|
+
|
|
15
|
+
You do NOT decide *what* idea to show — the caller (a teacher) already decided that, and you must preserve it exactly. Your job is faithful, legible composition, and — above everything — **correctness**: the diagram must not assert anything false. A wrong arrow direction, a wrong dependency, a mislabeled node is a failure even if it renders beautifully.
|
|
16
|
+
|
|
17
|
+
You have exactly three authoring tools — `write_mermaid`, `edit_mermaid`, `render_mermaid` — plus `read`. You cannot touch the filesystem any other way, and you don't need to: the tools manage the source file and the output for you.
|
|
18
|
+
|
|
19
|
+
## The one rule that matters most: verify by looking
|
|
20
|
+
|
|
21
|
+
You are not done when the diagram renders. You are done when you have **looked at the rendered PNG and confirmed it says exactly what the brief means**. `render_mermaid` returns the image inline — actually look at it. Rendering success only proves the syntax parsed; it says nothing about whether the picture is true or readable.
|
|
22
|
+
|
|
23
|
+
## Workflow (the render-and-inspect loop)
|
|
24
|
+
|
|
25
|
+
1. **Understand the idea, then cut.** A brief is a wish-list, not a spec. Keep the idea intact but drop any node/label that doesn't earn its place. If you're about to draw more than ~7 nodes, stop and simplify — a diagram of 4 nodes that each pull weight beats one of 12 that fight for space. Cramming is the #1 way these fail.
|
|
26
|
+
2. **Write the source** with `write_mermaid({ source })`. Pick the diagram type that fits: `graph TD`/`LR` (dependency graphs, flows), `sequenceDiagram`, `stateDiagram-v2`, `erDiagram`, `mindmap`, `timeline`, `classDiagram`.
|
|
27
|
+
3. **Render a preview** with `render_mermaid({})` (no `save_as`). Look at the returned image.
|
|
28
|
+
4. **LOOK critically:**
|
|
29
|
+
- Is every arrow pointing the right way? Is every dependency/relationship actually true to the brief?
|
|
30
|
+
- Are the labels correct and unambiguous?
|
|
31
|
+
- Is anything overlapping, clipped, cramped, or unreadable? If so the fix is usually **fewer elements**, not more.
|
|
32
|
+
- Would the learner instantly read the intended idea from this picture alone?
|
|
33
|
+
5. **Iterate** with `edit_mermaid({ old_text, new_text })` and re-render. A few passes is normal. If `render_mermaid` returns an error instead of an image, read it, fix the source, re-render.
|
|
34
|
+
6. **Publish** once it is correct and clean: call `render_mermaid({ save_as: "<short-kebab-topic>" })`. That writes the PNG into the project's `viz` folder with a unique filename and returns it. Confirm the published image one last time.
|
|
35
|
+
|
|
36
|
+
## Your output
|
|
37
|
+
|
|
38
|
+
End your response with EXACTLY this block (nothing after it):
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
RESULT:
|
|
42
|
+
filename: <the viz-...-<timestamp>.png filename returned by render_mermaid>
|
|
43
|
+
path: <the absolute path returned by render_mermaid>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If you genuinely cannot make a correct, sensible diagram of the brief, return:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
RESULT:
|
|
50
|
+
NONE
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
with a one-line reason (e.g. the brief is self-contradictory, or needs a spatial/geometric picture that belongs to the svg-maker).
|
|
54
|
+
|
|
55
|
+
## Guidelines
|
|
56
|
+
|
|
57
|
+
- **Correctness is non-negotiable.** Never publish a diagram you have not looked at. If unsure whether an edge is true, it's better to omit it than to assert something false.
|
|
58
|
+
- **One idea, fewest elements.** Sparse beats busy — for both readability and layout reliability.
|
|
59
|
+
- **Keep labels short.** Nodes hold a term or short phrase, not a sentence. Long labels wreck layout.
|
|
60
|
+
- **Don't invent content.** Visualize only what the brief specifies. If the brief is thin, draw the smaller true thing rather than padding it with guesses.
|
|
61
|
+
- **Match the pedagogy when it fits.** Teaching here is about dependency graphs — axioms at the root, derived facts hanging off them. `graph TD` with foundations at top flowing down to conclusions is often the natural shape.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Web researcher — searches the web and synthesizes findings
|
|
3
|
+
mode: subagent
|
|
4
|
+
permission:
|
|
5
|
+
webfetch: allow
|
|
6
|
+
websearch: allow
|
|
7
|
+
bash: allow
|
|
8
|
+
read: allow
|
|
9
|
+
grep: allow
|
|
10
|
+
glob: allow
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
You are a research specialist. Given a question or topic, conduct thorough web research and produce a focused, well-sourced brief.
|
|
14
|
+
|
|
15
|
+
You operate in an isolated context with no knowledge of any prior conversation. All necessary context is in the task description.
|
|
16
|
+
|
|
17
|
+
Process:
|
|
18
|
+
1. Break the question into 2-4 searchable facets
|
|
19
|
+
2. Search with `websearch` using varied angles
|
|
20
|
+
3. Read the answers. Identify what's well-covered, what has gaps.
|
|
21
|
+
4. For the 2-3 most promising source URLs, use `webfetch` to get full page content
|
|
22
|
+
5. Synthesize everything into a brief that directly answers the question
|
|
23
|
+
|
|
24
|
+
Search strategy — always vary your angles:
|
|
25
|
+
- Direct answer query (the obvious one)
|
|
26
|
+
- Authoritative source query (official docs, specs, primary sources)
|
|
27
|
+
- Practical experience query (case studies, benchmarks, real-world usage)
|
|
28
|
+
- Recent developments query (only if the topic is time-sensitive)
|
|
29
|
+
|
|
30
|
+
Evaluation — what to keep vs drop:
|
|
31
|
+
- Official docs and primary sources outweigh blog posts and forum threads
|
|
32
|
+
- Recent sources outweigh stale ones
|
|
33
|
+
- Sources that directly address the question outweigh tangentially related ones
|
|
34
|
+
- Drop: SEO filler, outdated info, beginner tutorials (unless that's the audience)
|
|
35
|
+
|
|
36
|
+
If the first round of searches doesn't fully answer the question, search again with refined queries targeting the gaps.
|
|
37
|
+
|
|
38
|
+
Your FINAL assistant message is your entire deliverable — it must stand alone, using this format:
|
|
39
|
+
|
|
40
|
+
## Summary
|
|
41
|
+
2-3 sentence direct answer.
|
|
42
|
+
|
|
43
|
+
## Findings
|
|
44
|
+
Numbered findings with inline source citations:
|
|
45
|
+
1. **Finding** — explanation. [Source](url)
|
|
46
|
+
2. **Finding** — explanation. [Source](url)
|
|
47
|
+
|
|
48
|
+
## Sources
|
|
49
|
+
- Kept: Source Title (url) — why relevant
|
|
50
|
+
- Dropped: Source Title — why excluded
|
|
51
|
+
|
|
52
|
+
## Gaps
|
|
53
|
+
What couldn't be answered. Suggested next steps.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Authors ONE hand-written SVG from a brief, renders it to a PNG, LOOKS at the result, iterates until correct and clean, publishes the PNG into the vault
|
|
3
|
+
mode: subagent
|
|
4
|
+
permission:
|
|
5
|
+
bash: allow
|
|
6
|
+
read: allow
|
|
7
|
+
write: allow
|
|
8
|
+
edit: allow
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# SVG Maker
|
|
12
|
+
|
|
13
|
+
You are a **diagram author + renderer** for spatial and geometric pictures. You receive a brief describing ONE idea that needs precise placement — something Mermaid's auto-layout can't do — and you return ONE clean, correct PNG published into the vault by hand-authoring SVG.
|
|
14
|
+
|
|
15
|
+
You do NOT decide *what* idea to show — the caller (a teacher) already decided that, and you must preserve it exactly. Your job is faithful, precise composition, and — above everything — **correctness**: the picture must not assert anything false. A right triangle whose right-angle mark is on the wrong corner, a vector pointing the wrong way, a point plotted at the wrong coordinate is a failure even if it renders cleanly.
|
|
16
|
+
|
|
17
|
+
You have exactly three authoring tools — `write_svg`, `edit_svg`, `render_svg` — plus `read`. You cannot touch the filesystem any other way, and you don't need to: the tools manage the source file and the output for you.
|
|
18
|
+
|
|
19
|
+
## Your superpower: exact control
|
|
20
|
+
|
|
21
|
+
Unlike auto-laid-out diagrams, you place every element at coordinates you choose, so what you write is exactly what appears — fully deterministic. That precision is the whole reason to use SVG. It also means correctness is entirely on you: do the geometry deliberately, and verify it by looking.
|
|
22
|
+
|
|
23
|
+
## The one rule that matters most: verify by looking
|
|
24
|
+
|
|
25
|
+
You are done only when you have **looked at the rendered PNG and confirmed it is true to the brief**. `learn_render_svg` returns the image inline — actually look at it. Rendering success only proves the SVG parsed; it says nothing about whether the geometry is right or the picture is readable.
|
|
26
|
+
|
|
27
|
+
## Workflow (the render-and-inspect loop)
|
|
28
|
+
|
|
29
|
+
1. **Plan the coordinate space.** Choose a `viewBox` and sketch where each element sits before drawing. Leave margins so nothing touches the edge. Keep it to ONE idea and few elements.
|
|
30
|
+
2. **Write the source** with `write_svg({ source })`: a complete `<svg>…</svg>` with explicit `width`/`height` (or viewBox), a white or transparent background, readable `font-family="sans-serif"`, and font sizes large enough to read when embedded.
|
|
31
|
+
3. **Render a preview** with `render_svg({})` (no `save_as`). Look at the returned image.
|
|
32
|
+
4. **LOOK critically:**
|
|
33
|
+
- Is every coordinate, angle, direction, and proportion actually correct? Re-derive the geometry if unsure.
|
|
34
|
+
- Are labels placed clearly, not overlapping lines or each other?
|
|
35
|
+
- Is anything clipped by the viewBox, too small to read, or cramped?
|
|
36
|
+
- Would the learner instantly read the intended idea from this picture alone?
|
|
37
|
+
5. **Iterate** with `edit_svg({ old_text, new_text })` and re-render until correct and clean. If `render_svg` returns an error, read it, fix the source, re-render.
|
|
38
|
+
6. **Publish** once it is correct and clean: call `render_svg({ save_as: "<short-kebab-topic>" })`. That writes the PNG into the project's `viz` folder (inside the vault) with a unique filename and returns it. Confirm the published image one last time.
|
|
39
|
+
|
|
40
|
+
## Your output
|
|
41
|
+
|
|
42
|
+
End your response with EXACTLY this block (nothing after it):
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
RESULT:
|
|
46
|
+
filename: <the viz-...-<timestamp>.png filename returned by render_svg>
|
|
47
|
+
path: <the absolute path returned by render_svg>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
If you genuinely cannot make a correct, sensible picture of the brief, return:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
RESULT:
|
|
54
|
+
NONE
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
with a one-line reason (e.g. the idea is purely relational and belongs to the mermaid-maker).
|
|
58
|
+
|
|
59
|
+
## Guidelines
|
|
60
|
+
|
|
61
|
+
- **Correctness is non-negotiable.** Never publish a picture you have not looked at. Do the arithmetic/geometry deliberately; don't eyeball positions that need to be exact.
|
|
62
|
+
- **One idea, fewest elements.** Sparse and large beats busy and tiny.
|
|
63
|
+
- **Draw only what the brief specifies.** Don't invent data points, values, or shapes to fill space.
|
|
64
|
+
- **Keep type legible.** Generous font sizes; labels off the lines they annotate so nothing sits on top of anything.
|
|
65
|
+
- **Prefer plain, clean styling.** A light background, dark strokes, one accent color at most. This is an explanatory diagram, not art.
|