superwiki 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/.claude-plugin/marketplace.json +16 -0
- package/.claude-plugin/plugin.json +17 -0
- package/.codex-plugin/plugin.json +12 -0
- package/LICENSE +21 -0
- package/README.md +197 -0
- package/bin/superwiki.mjs +116 -0
- package/commands/config.md +5 -0
- package/commands/explain.md +5 -0
- package/commands/implement.md +5 -0
- package/commands/ingest.md +5 -0
- package/commands/init.md +5 -0
- package/commands/lint.md +5 -0
- package/commands/migrate.md +5 -0
- package/commands/plan.md +5 -0
- package/commands/triage.md +5 -0
- package/commands/visualize.md +5 -0
- package/install.sh +27 -0
- package/package.json +45 -0
- package/skills/sw-config/SKILL.md +39 -0
- package/skills/sw-config/assets/implementer.md +15 -0
- package/skills/sw-config/assets/planner.md +17 -0
- package/skills/sw-config/scripts/config.mjs +104 -0
- package/skills/sw-explain/SKILL.md +30 -0
- package/skills/sw-implement/SKILL.md +46 -0
- package/skills/sw-ingest/SKILL.md +43 -0
- package/skills/sw-init/SKILL.md +52 -0
- package/skills/sw-init/assets/agents-block.md +29 -0
- package/skills/sw-init/assets/sw.mjs +523 -0
- package/skills/sw-init/assets/templates/page.md +18 -0
- package/skills/sw-init/assets/templates/plan.md +25 -0
- package/skills/sw-init/assets/templates/task.md +33 -0
- package/skills/sw-init/assets/viewer.html +1660 -0
- package/skills/sw-init/scripts/init.mjs +118 -0
- package/skills/sw-lint/SKILL.md +61 -0
- package/skills/sw-migrate/SKILL.md +61 -0
- package/skills/sw-migrate/scripts/migrate.mjs +225 -0
- package/skills/sw-plan/SKILL.md +46 -0
- package/skills/sw-triage/SKILL.md +42 -0
- package/skills/sw-visualize/SKILL.md +28 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "superwiki",
|
|
3
|
+
"owner": {
|
|
4
|
+
"name": "Mehmet Serefoglu"
|
|
5
|
+
},
|
|
6
|
+
"plugins": [
|
|
7
|
+
{
|
|
8
|
+
"name": "sw",
|
|
9
|
+
"source": "./",
|
|
10
|
+
"description": "An LLM-maintained wiki and task tracker in docs/ for coding agents. Obsidian friendly, with a static viewer."
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"metadata": {
|
|
14
|
+
"description": "Superwiki: agent skills for an LLM-maintained wiki and task tracker"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sw",
|
|
3
|
+
"description": "An LLM-maintained wiki and task tracker in docs/ for coding agents. Obsidian friendly, with a static viewer.",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"wiki",
|
|
8
|
+
"second-brain",
|
|
9
|
+
"obsidian",
|
|
10
|
+
"tasks",
|
|
11
|
+
"planning",
|
|
12
|
+
"skills"
|
|
13
|
+
],
|
|
14
|
+
"author": {
|
|
15
|
+
"name": "Mehmet Serefoglu"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "sw",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "An LLM-maintained wiki and task tracker in docs/ for coding agents. Obsidian friendly, with a static viewer.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"skills": "./skills/",
|
|
7
|
+
"interface": {
|
|
8
|
+
"displayName": "Superwiki",
|
|
9
|
+
"shortDescription": "LLM-maintained wiki and task tracker in docs/",
|
|
10
|
+
"category": "Developer Tools"
|
|
11
|
+
}
|
|
12
|
+
}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mehmet Serefoglu
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# Superwiki
|
|
2
|
+
|
|
3
|
+
Agent skills that turn a project's `docs/` folder into an **LLM-maintained wiki and task tracker**. Your coding agent writes it and keeps it current; you read it as an **Obsidian vault** or in a built-in viewer. Works with **Claude Code, Codex CLI and GitHub Copilot CLI**.
|
|
4
|
+
|
|
5
|
+
**[Live demo](https://mhmtsrfglu.github.io/superwiki/)** · [Install](#install) · [Commands](#use) · [Design notes](DESIGN.md)
|
|
6
|
+
|
|
7
|
+
<picture>
|
|
8
|
+
<source media="(prefers-color-scheme: dark)" srcset="assets/viewer-waves-dark.png">
|
|
9
|
+
<img alt="The Superwiki viewer: task counts per area, filters, and the dependency board with one task's chain highlighted" src="assets/viewer-waves-light.png">
|
|
10
|
+
</picture>
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npx superwiki install claude # or: codex, copilot, global, all
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Then, in a project: `/sw-init`.
|
|
17
|
+
|
|
18
|
+
## Why
|
|
19
|
+
|
|
20
|
+
Superwiki follows the LLM Wiki pattern described by Andrej Karpathy: raw sources you curate, a wiki the agent owns, and a short schema that tells the agent how to maintain it. On top of that it adds what a software project needs: tasks with dependencies, plans, and a record of decisions and lessons.
|
|
21
|
+
|
|
22
|
+
It is built to be cheap for the agent. One small index to read, one file per task, and a script that answers "what is ready?", "what blocks this?" or "is anything broken?" without the agent reading the vault.
|
|
23
|
+
|
|
24
|
+
Measured on a real project with 165 tasks, converted from a single markdown index:
|
|
25
|
+
|
|
26
|
+
| | Before | After |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Read at the start of every session | 197 KB index | 94-byte catalog + 1.7 KB of rules |
|
|
29
|
+
| Read to start one task | the index, then the task's section | one file, 2 KB at the median |
|
|
30
|
+
| Marking a task done | a status cell, plus a ✅ at every reference to it (median 12 places) | one frontmatter line |
|
|
31
|
+
|
|
32
|
+
> Status: early. The CLI, the viewer, `sw-init` and the migration script are tested, and the planning flow has been run in all three agents; some skills have only been exercised once. [DESIGN.md](DESIGN.md) lists what has and has not been proven.
|
|
33
|
+
|
|
34
|
+
## What you get
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
docs/
|
|
38
|
+
index.md catalog of the wiki, one line per page
|
|
39
|
+
log.md append-only history
|
|
40
|
+
raw/ your sources, never modified
|
|
41
|
+
wiki/ pages the agent writes
|
|
42
|
+
tasks/ one file per task (optional)
|
|
43
|
+
plans/ one plan per task
|
|
44
|
+
viewer.html opened by sw-visualize, in any browser
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`AGENTS.md` gets a short block of rules so the agent maintains the vault in every session, with or without a command.
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
Requires Node 18 or newer.
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx superwiki install claude
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This copies the skills into the folder your agent reads. Name one or more targets:
|
|
58
|
+
|
|
59
|
+
| Target | Installs into | For |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| `claude` | `~/.claude/skills` | [Claude Code](#claude-code) |
|
|
62
|
+
| `codex` | `~/.agents/skills` | [Codex CLI](#codex-cli) |
|
|
63
|
+
| `copilot` | `~/.copilot/skills` | [GitHub Copilot CLI](#github-copilot-cli) |
|
|
64
|
+
| `global` | `~/.agents/skills` | the shared folder: Codex, Copilot CLI and [other agents](#other-agents) that read it. Claude Code does not |
|
|
65
|
+
| `all` | all of the above | |
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx superwiki install claude codex # several agents at once
|
|
69
|
+
npx superwiki install --project ~/code/my-app all # one project only, not your home folder
|
|
70
|
+
npx superwiki uninstall claude # remove
|
|
71
|
+
npx superwiki --help
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Start a new agent session after installing: a running session does not pick up new skills.
|
|
75
|
+
|
|
76
|
+
### From a clone
|
|
77
|
+
|
|
78
|
+
If you would rather read the code first, or want to change it:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://github.com/mhmtsrfglu/superwiki ~/.superwiki
|
|
82
|
+
~/.superwiki/install.sh claude # same targets and options; links instead of copying
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
A linked install follows the clone: `git pull` updates every agent. `install.sh --copy` copies instead, `--uninstall` removes.
|
|
86
|
+
|
|
87
|
+
All three agents below were checked the same way: the agent found the skills, refused to start a task with an unfinished dependency, and ran `sw-plan` end to end with the planner subagent.
|
|
88
|
+
|
|
89
|
+
### Claude Code
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npx superwiki install claude
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Invoke with a slash: `/sw-init`, `/sw-plan T-01`.
|
|
96
|
+
|
|
97
|
+
Claude Code reads `~/.claude/skills/` (and a project's `.claude/skills/`); it does not read `~/.agents/skills/`, so `global` is not enough for it.
|
|
98
|
+
|
|
99
|
+
`sw-plan` enters plan mode when the session offers it. A model set with `sw-config` for `claude` applies to the planner and implementer subagents, written to `.claude/agents/`; if those agents are not loaded, the skills fall back to built-in agents with the same model.
|
|
100
|
+
|
|
101
|
+
### Codex CLI
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
npx superwiki install codex
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Invoke with a dollar sign, or by name in a sentence: `$sw-init`, `$sw-plan T-01`, "use the sw-plan skill for T-01". Checked with CLI 0.153.
|
|
108
|
+
|
|
109
|
+
A skill cannot switch Codex into plan mode; start planning yourself with `/plan` if you want the mode, or let `sw-plan` proceed without it (it changes no file before you approve). A model set with `sw-config` for `codex` is written to `.codex/agents/sw-planner.toml` and `sw-implementer.toml`, and the skills spawn those agents by name. Subagents must be enabled (they are by default in current releases).
|
|
110
|
+
|
|
111
|
+
### GitHub Copilot CLI
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npx superwiki install copilot
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Invoke with a slash, or by name in a sentence: `/sw-init`, "use the sw-plan skill for T-01". Checked with CLI 1.0.31.
|
|
118
|
+
|
|
119
|
+
Copilot CLI also reads `~/.agents/skills/`, so if you installed `codex` or `global` it already has the skills.
|
|
120
|
+
|
|
121
|
+
A skill cannot switch Copilot into plan mode; start with `copilot --mode plan` or `/plan` if you want it. A model set with `sw-config` for `copilot` is written to `.github/agents/sw-planner.agent.md` and `sw-implementer.agent.md`; the skills dispatch them with the `task` tool. Whether Copilot honours the `model:` field of those files has not been checked.
|
|
122
|
+
|
|
123
|
+
### Other agents
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
npx superwiki install global
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Agents that load `SKILL.md` folders from `~/.agents/skills` pick the skills up from there. For an agent with its own skills folder (Cursor, Gemini CLI, OpenCode and others), copy the `skills/sw-*` folders from a clone into it by hand. Nothing has been run in these agents. What will differ:
|
|
130
|
+
|
|
131
|
+
- the skills name Claude Code, Codex and Copilot tools when they dispatch subagents; elsewhere they fall back to doing the planning or implementing in the main session, and say so;
|
|
132
|
+
- `sw-config` writes agent files only for `claude`, `codex` and `copilot`, so a per-role model cannot be set.
|
|
133
|
+
|
|
134
|
+
Everything else (the vault, the CLI, the viewer, ingest, lint, explain, triage) depends only on Node and on the agent following the skill text.
|
|
135
|
+
|
|
136
|
+
### With other skill sets
|
|
137
|
+
|
|
138
|
+
Superwiki works next to planning skill sets such as Superpowers. Two things to know:
|
|
139
|
+
|
|
140
|
+
- Their bootstrap may claim a bare `/sw-...` prompt before Superwiki's skill loads. Naming the skill in a sentence ("use the sw-implement skill for T-02") avoids that.
|
|
141
|
+
- Folders they create under `docs/` are left alone: Superwiki only reads and writes `index.md`, `log.md`, `raw/`, `wiki/`, `tasks/` and `plans/`.
|
|
142
|
+
|
|
143
|
+
### Update and uninstall
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
npx superwiki@latest install claude # update: same command, newest release
|
|
147
|
+
npx superwiki uninstall all
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
After an update, run `sw-init` again in each project: it replaces `docs/.sw/sw.mjs`, the templates and `docs/viewer.html` with the new version and keeps your content.
|
|
151
|
+
|
|
152
|
+
A project's `docs/` folder is plain markdown and keeps working as an Obsidian vault without Superwiki.
|
|
153
|
+
|
|
154
|
+
## Use
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
sw-init set up docs/ in the current project
|
|
158
|
+
sw-migrate convert an existing table-based task index, on a new git branch
|
|
159
|
+
sw-ingest file a source from docs/raw/ into the wiki
|
|
160
|
+
sw-plan plan a task with a planner subagent, save the approved plan
|
|
161
|
+
sw-implement run a task with an implementer subagent, record the result
|
|
162
|
+
sw-explain explain a task: what, why, dependencies, what it unblocks
|
|
163
|
+
sw-triage for a problem: seen before? lessons, likely causes
|
|
164
|
+
sw-lint structural checks by script, semantic review on request
|
|
165
|
+
sw-visualize open the viewer
|
|
166
|
+
sw-config models per role and tool, task areas
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
A filled-in example vault is in [examples/demo/docs](examples/demo/docs).
|
|
170
|
+
|
|
171
|
+
After that, from the project root:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
node docs/.sw/sw.mjs status # counts per area
|
|
175
|
+
node docs/.sw/sw.mjs ready # tasks that can start now
|
|
176
|
+
node docs/.sw/sw.mjs check M-01 # what blocks this task
|
|
177
|
+
node docs/.sw/sw.mjs explain M-01 # its place in the dependency chain
|
|
178
|
+
node docs/.sw/sw.mjs search sync timeout # where something is mentioned
|
|
179
|
+
node docs/.sw/sw.mjs next-id M # next free id
|
|
180
|
+
node docs/.sw/sw.mjs lint # broken links, bad frontmatter, dependency errors
|
|
181
|
+
node docs/.sw/sw.mjs serve --open # the viewer, reading files live
|
|
182
|
+
node docs/.sw/sw.mjs snapshot # or: freeze the vault into docs/viewer.html, no server
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## Develop
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm test # builds skills/sw-init/assets/sw.mjs, then runs the tests
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`node scripts/build-demo.mjs` builds the public demo into `site/` (the viewer with the example vault baked in); the Pages workflow deploys it on every push to `main`.
|
|
192
|
+
|
|
193
|
+
`src/core.js` is shared by the CLI and the viewer. Edit sources in `src/`; the files in `skills/sw-init/assets/` named `sw.mjs` and `viewer.html` are generated.
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Installs the Superwiki skills into the folder each coding agent reads.
|
|
3
|
+
// Run from npm (`npx superwiki install claude`) it copies them; `--link` links them to this
|
|
4
|
+
// checkout instead, which is what install.sh does for a git clone.
|
|
5
|
+
import { existsSync, lstatSync, readlinkSync, realpathSync, mkdirSync, readdirSync, rmSync, cpSync, symlinkSync, writeFileSync, readFileSync, statSync } from 'node:fs';
|
|
6
|
+
import { dirname, join, resolve } from 'node:path';
|
|
7
|
+
import { homedir } from 'node:os';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), '..');
|
|
11
|
+
const skillsDir = join(root, 'skills');
|
|
12
|
+
const TARGETS = ['claude', 'codex', 'copilot', 'global'];
|
|
13
|
+
const MARKER = '.sw-installed';
|
|
14
|
+
|
|
15
|
+
const HELP = `Usage: superwiki install [options] <target>...
|
|
16
|
+
superwiki uninstall [options] <target>...
|
|
17
|
+
|
|
18
|
+
Targets:
|
|
19
|
+
claude ~/.claude/skills Claude Code
|
|
20
|
+
codex ~/.agents/skills Codex CLI
|
|
21
|
+
copilot ~/.copilot/skills GitHub Copilot CLI
|
|
22
|
+
global ~/.agents/skills the shared folder: Codex, Copilot CLI and other agents that read it
|
|
23
|
+
(Claude Code does not)
|
|
24
|
+
all claude + codex + copilot
|
|
25
|
+
|
|
26
|
+
Options:
|
|
27
|
+
--project <dir> install into that project instead of your home folder
|
|
28
|
+
(.claude/skills for claude, .agents/skills for the others)
|
|
29
|
+
--link link the skills to this copy of Superwiki instead of copying them
|
|
30
|
+
(for a git clone: updating the clone then updates every agent)
|
|
31
|
+
--force replace or remove a skill folder that Superwiki did not install
|
|
32
|
+
-v, --version print the version
|
|
33
|
+
-h, --help show this help
|
|
34
|
+
|
|
35
|
+
Examples:
|
|
36
|
+
npx superwiki install claude
|
|
37
|
+
npx superwiki install claude codex
|
|
38
|
+
npx superwiki install --project ~/code/my-app all
|
|
39
|
+
npx superwiki uninstall copilot
|
|
40
|
+
|
|
41
|
+
Run the same command again after a new release to update. Then start a new agent session
|
|
42
|
+
and run sw-init in a project.`;
|
|
43
|
+
|
|
44
|
+
const argv = process.argv.slice(2);
|
|
45
|
+
const fail = (msg, code = 2) => { console.error(msg); process.exit(code); };
|
|
46
|
+
if (argv.includes('-h') || argv.includes('--help') || !argv.length) { console.log(HELP); process.exit(argv.length ? 0 : 2); }
|
|
47
|
+
if (argv.includes('-v') || argv.includes('--version')) { console.log(JSON.parse(readFileSync(join(root, 'package.json'), 'utf8')).version); process.exit(0); }
|
|
48
|
+
|
|
49
|
+
const command = argv[0];
|
|
50
|
+
if (command !== 'install' && command !== 'uninstall') fail(`unknown command: ${command}\n\n${HELP}`);
|
|
51
|
+
let project = '';
|
|
52
|
+
let link = false;
|
|
53
|
+
let force = false;
|
|
54
|
+
const targets = [];
|
|
55
|
+
for (let i = 1; i < argv.length; i++) {
|
|
56
|
+
const a = argv[i];
|
|
57
|
+
if (a === '--project') { project = argv[++i] || fail('--project needs a folder'); }
|
|
58
|
+
else if (a === '--link') link = true;
|
|
59
|
+
else if (a === '--force') force = true;
|
|
60
|
+
else if (a === 'all') targets.push('claude', 'codex', 'copilot');
|
|
61
|
+
else if (TARGETS.includes(a)) targets.push(a);
|
|
62
|
+
else fail(`unknown argument: ${a}\n\n${HELP}`);
|
|
63
|
+
}
|
|
64
|
+
if (!targets.length) fail(`name at least one target: ${TARGETS.join(', ')}, all`);
|
|
65
|
+
if (!existsSync(skillsDir)) fail(`no skills/ folder in ${root}`, 1);
|
|
66
|
+
if (project) {
|
|
67
|
+
if (!existsSync(project) || !statSync(project).isDirectory()) fail(`no such project folder: ${project}`, 1);
|
|
68
|
+
project = realpathSync(project);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const destFor = t => (project
|
|
72
|
+
? join(project, t === 'claude' ? '.claude/skills' : '.agents/skills')
|
|
73
|
+
: join(homedir(), t === 'claude' ? '.claude/skills' : t === 'copilot' ? '.copilot/skills' : '.agents/skills'));
|
|
74
|
+
|
|
75
|
+
const exists = p => { try { lstatSync(p); return true; } catch { return false; } };
|
|
76
|
+
// Ours: a link that ends up in this copy's skills folder, or a copy carrying the marker file.
|
|
77
|
+
function isOurs(p, name) {
|
|
78
|
+
if (lstatSync(p).isSymbolicLink()) {
|
|
79
|
+
if (readlinkSync(p).startsWith(skillsDir + '/')) return true;
|
|
80
|
+
try { return realpathSync(p) === realpathSync(join(skillsDir, name)); } catch { return false; }
|
|
81
|
+
}
|
|
82
|
+
return existsSync(join(p, MARKER));
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const skills = readdirSync(skillsDir).filter(n => n.startsWith('sw-') && statSync(join(skillsDir, n)).isDirectory()).sort();
|
|
86
|
+
const seen = new Set();
|
|
87
|
+
let status = 0;
|
|
88
|
+
for (const target of targets) {
|
|
89
|
+
const dest = destFor(target);
|
|
90
|
+
if (seen.has(dest)) continue; // codex and global share a folder
|
|
91
|
+
seen.add(dest);
|
|
92
|
+
console.log(`${target}: ${dest}`);
|
|
93
|
+
if (command === 'install') mkdirSync(dest, { recursive: true });
|
|
94
|
+
for (const name of skills) {
|
|
95
|
+
const path = join(dest, name);
|
|
96
|
+
if (exists(path)) {
|
|
97
|
+
if (!isOurs(path, name) && !force) {
|
|
98
|
+
if (command === 'install') { console.log(` skipped ${name} (a different ${name} is already there; --force replaces it)`); status = 1; }
|
|
99
|
+
else console.log(` kept ${name} (not installed by Superwiki; --force removes it)`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
rmSync(path, { recursive: true, force: true });
|
|
103
|
+
if (command === 'uninstall') console.log(` removed ${name}`);
|
|
104
|
+
}
|
|
105
|
+
if (command === 'uninstall') continue;
|
|
106
|
+
if (link) { symlinkSync(join(skillsDir, name), path); console.log(` linked ${name}`); }
|
|
107
|
+
else { cpSync(join(skillsDir, name), path, { recursive: true }); writeFileSync(join(path, MARKER), ''); console.log(` copied ${name}`); }
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (command === 'install') {
|
|
112
|
+
const major = Number(process.versions.node.split('.')[0]);
|
|
113
|
+
if (major < 18) console.error(`warning: Node ${major} found; the Superwiki scripts need Node 18 or newer`);
|
|
114
|
+
console.log('\nStart a new agent session, then run sw-init in a project.');
|
|
115
|
+
}
|
|
116
|
+
process.exit(status);
|
package/commands/init.md
ADDED
package/commands/lint.md
ADDED
package/commands/plan.md
ADDED
package/install.sh
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Installs the Superwiki skills from this checkout by linking them into the folder each agent reads.
|
|
3
|
+
# A thin wrapper around bin/superwiki.mjs, for people who cloned the repository.
|
|
4
|
+
#
|
|
5
|
+
# ./install.sh claude link the skills for Claude Code
|
|
6
|
+
# ./install.sh --copy all copy instead of link
|
|
7
|
+
# ./install.sh --uninstall codex remove them
|
|
8
|
+
# ./install.sh --help
|
|
9
|
+
set -euo pipefail
|
|
10
|
+
|
|
11
|
+
SUPERWIKI_HOME="${SUPERWIKI_HOME:-$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)}"
|
|
12
|
+
command -v node >/dev/null 2>&1 || { echo "node not found; Superwiki needs Node 18 or newer" >&2; exit 1; }
|
|
13
|
+
[ -f "$SUPERWIKI_HOME/bin/superwiki.mjs" ] || { echo "no bin/superwiki.mjs in $SUPERWIKI_HOME; set SUPERWIKI_HOME to the Superwiki repository" >&2; exit 1; }
|
|
14
|
+
|
|
15
|
+
command="install"
|
|
16
|
+
link="--link"
|
|
17
|
+
args=()
|
|
18
|
+
for a in "$@"; do
|
|
19
|
+
case "$a" in
|
|
20
|
+
--uninstall) command="uninstall"; link="" ;;
|
|
21
|
+
--copy) link="" ;;
|
|
22
|
+
*) args+=("$a") ;;
|
|
23
|
+
esac
|
|
24
|
+
done
|
|
25
|
+
|
|
26
|
+
# ${args[@]+...} keeps bash 3.2 (macOS) from failing on an empty array under `set -u`.
|
|
27
|
+
exec node "$SUPERWIKI_HOME/bin/superwiki.mjs" "$command" ${link:+"$link"} ${args[@]+"${args[@]}"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "superwiki",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Agent skills that turn docs/ into an LLM-maintained wiki and task tracker. Obsidian-friendly. Works with Claude Code, Codex and Copilot CLI.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"claude-code",
|
|
7
|
+
"agent-skills",
|
|
8
|
+
"codex",
|
|
9
|
+
"github-copilot",
|
|
10
|
+
"obsidian",
|
|
11
|
+
"llm-wiki",
|
|
12
|
+
"knowledge-base",
|
|
13
|
+
"ai-agents",
|
|
14
|
+
"task-management",
|
|
15
|
+
"wiki"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/mhmtsrfglu/superwiki#readme",
|
|
18
|
+
"bugs": "https://github.com/mhmtsrfglu/superwiki/issues",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/mhmtsrfglu/superwiki.git"
|
|
22
|
+
},
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"author": "Mehmet Şerefoğlu",
|
|
25
|
+
"type": "module",
|
|
26
|
+
"bin": {
|
|
27
|
+
"superwiki": "bin/superwiki.mjs"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"bin",
|
|
31
|
+
"skills",
|
|
32
|
+
"commands",
|
|
33
|
+
".claude-plugin",
|
|
34
|
+
".codex-plugin",
|
|
35
|
+
"install.sh"
|
|
36
|
+
],
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=18"
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "node scripts/build.mjs",
|
|
42
|
+
"test": "node scripts/build.mjs && node --test",
|
|
43
|
+
"prepublishOnly": "npm test"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sw-config
|
|
3
|
+
description: Use when the user wants to choose or change which model plans or implements Superwiki tasks (opus, sonnet, gpt and so on), add task areas, see the Superwiki configuration, or invokes sw-config or sw:config.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# sw-config
|
|
7
|
+
|
|
8
|
+
Settings live in `docs/.sw/config.json`. Change them with the script, from the project root; it also writes the agent files that make a model choice take effect. `<skill-dir>` is this skill's directory.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
node <skill-dir>/scripts/config.mjs show
|
|
12
|
+
node <skill-dir>/scripts/config.mjs model plan claude opus
|
|
13
|
+
node <skill-dir>/scripts/config.mjs model implement codex gpt-6
|
|
14
|
+
node <skill-dir>/scripts/config.mjs model plan copilot --unset
|
|
15
|
+
node <skill-dir>/scripts/config.mjs areas "M=Mobile,B=Backend"
|
|
16
|
+
node <skill-dir>/scripts/config.mjs sync --tools claude,codex,copilot
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Models
|
|
20
|
+
|
|
21
|
+
A model is chosen per role (`plan`, `implement`) and per tool (`claude`, `codex`, `copilot`), because each tool can only run its own models. No tool lets a skill change the model of the running session, so sw-plan and sw-implement hand the work to a subagent, and the subagent's file carries the model.
|
|
22
|
+
|
|
23
|
+
| Tool | File the script writes | Read-only planner by |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| Claude Code | `.claude/agents/sw-planner.md`, `sw-implementer.md` | `tools:` list |
|
|
26
|
+
| Codex | `.codex/agents/sw-planner.toml`, `sw-implementer.toml` | `sandbox_mode` |
|
|
27
|
+
| Copilot CLI | `.github/agents/sw-planner.agent.md`, `sw-implementer.agent.md` | `tools:` list |
|
|
28
|
+
|
|
29
|
+
When the user asks to set a model:
|
|
30
|
+
|
|
31
|
+
1. Ask only for what is missing: role, tool, model. If they name a model without a tool, infer the tool from the model family and say which you chose. Use the model name exactly as that tool spells it; do not translate names between tools.
|
|
32
|
+
2. Run the `model` command. Show its output.
|
|
33
|
+
3. Say that a tool picks up new agent files when its next session starts.
|
|
34
|
+
|
|
35
|
+
Do not edit the generated agent files or `config.json` by hand; the next `sync` overwrites agent files.
|
|
36
|
+
|
|
37
|
+
## Areas
|
|
38
|
+
|
|
39
|
+
`areas` adds prefixes or renames them. It never removes one: tasks keep their ids forever.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
You implement one task in a Superwiki vault.
|
|
2
|
+
|
|
3
|
+
Input: a task id.
|
|
4
|
+
|
|
5
|
+
1. Read `docs/tasks/<ID>.md` and, if it exists, `docs/plans/<ID>-plan.md`. Read linked pages only when a step needs them.
|
|
6
|
+
2. Do the work. Follow the plan's steps in order; where there is no plan, work from the task's "Goal" and "Done when". Follow the repository's own rules (`AGENTS.md`).
|
|
7
|
+
3. Verify each "Done when" item with the plan's verification commands. Run them; do not assume.
|
|
8
|
+
4. Do not edit `docs/tasks/<ID>.md`, `docs/log.md` or `docs/index.md`: the session that dispatched you records status. If you learned something the wiki should hold (a decision made, a constraint found), say so in your report instead of writing it.
|
|
9
|
+
5. Stop and report, without guessing, if the plan cannot be followed as written, a dependency is missing, or a "Done when" item cannot be met.
|
|
10
|
+
|
|
11
|
+
Report:
|
|
12
|
+
- each "Done when" item: met or not, with the command you ran and its result;
|
|
13
|
+
- files changed;
|
|
14
|
+
- deviations from the plan and why;
|
|
15
|
+
- anything the wiki or a follow-up task should record.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
You write the plan for one task in a Superwiki vault. You do not change any file.
|
|
2
|
+
|
|
3
|
+
Input: a task id, and possibly notes from the conversation with the user.
|
|
4
|
+
|
|
5
|
+
1. Read `docs/tasks/<ID>.md`. Read the pages it links only if the task depends on what they say. Read `docs/plans/<ID>-plan.md` if it exists: you are revising it.
|
|
6
|
+
2. Read the code the task touches. Find the existing patterns the work must follow and the commands that verify it.
|
|
7
|
+
3. Return the plan as the complete content of `docs/plans/<ID>-plan.md`, in the format of `docs/.sw/templates/plan.md`: frontmatter (`type: plan`, `task: <ID>`, `updated:` today), then `## Approach`, `## Steps`, `## Verification`.
|
|
8
|
+
- Steps are ordered, each names the files it touches and how to check it. Someone with no other context must be able to follow them.
|
|
9
|
+
- Verification maps every "Done when" item of the task to a command or check.
|
|
10
|
+
- Link vault pages as `[[file-name]]`; refer to code by plain path.
|
|
11
|
+
- The plan is saved without the notes and read by someone who has only the task file and the plan. Do not refer to the notes, to these instructions or to agent files from inside it. Where you had to assume an answer to an open question, state the assumption in `## Approach`.
|
|
12
|
+
- Check every example output you quote by running or tracing the code; do not guess what the current code returns.
|
|
13
|
+
4. After the plan, under a line `=== notes ===`, list:
|
|
14
|
+
- open questions that only the user can answer;
|
|
15
|
+
- if the work does not fit one working session: how to split it into tasks (title and dependencies for each).
|
|
16
|
+
|
|
17
|
+
Return only the plan and the notes.
|