superwiki 0.1.0 → 0.1.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.
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  type: plan
3
3
  task: T-01
4
+ status: draft
4
5
  updated: YYYY-MM-DD
5
6
  ---
6
7
 
@@ -8,18 +9,24 @@ updated: YYYY-MM-DD
8
9
 
9
10
  ## Approach
10
11
 
11
- The chosen approach in a few sentences, and what was ruled out.
12
+ The chosen approach and the assumptions it rests on, in a few lines.
13
+
14
+ ## Read first
15
+
16
+ - path/to/file: the function, section or lines that matter.
12
17
 
13
18
  ## Steps
14
19
 
15
- 1. Step with the files it touches and how to verify it.
20
+ 1. Files, the change in a sentence or two, and how to check it.
16
21
 
17
22
  ## Verification
18
23
 
19
- Commands or checks that prove the task's "Done when" list.
24
+ - "Done when" item: the command or check that proves it.
20
25
 
21
26
  <!--
22
- File: docs/plans/<ID>-plan.md, one plan per task. Rewrite in place; git keeps old versions.
27
+ File: docs/plans/<ID>-plan.md, one plan per task, 40 to 60 lines for most tasks.
28
+ status: draft until the user approves it, then approved. Rewrite in place; git keeps old versions.
29
+ Mark a check "needs: running stack" or "needs: data change" when it cannot run from a clean checkout.
23
30
  Design shared by several tasks is a `type: decision` wiki page that the plans link to.
24
31
  Delete this comment.
25
32
  -->
@@ -579,8 +579,8 @@ function lint(vault) {
579
579
  if (!p.data.type) add('error', 'missing-field', p.path, 'frontmatter `type` is missing');
580
580
  if (!p.data.summary) add('warn', 'missing-field', p.path, 'frontmatter `summary` is missing');
581
581
  if (vault.index && !vault.index.links.some(l => resolve(vault, l.target) === p)) add('warn', 'not-in-index', p.path, 'page is not listed in index.md');
582
- // A source summary is reachable from the index and need not be cited yet; ingest stays a three-file change.
583
- if (p.data.type !== 'source' && !p.inbound.some(q => q !== vault.index && q !== vault.log)) add('warn', 'orphan-page', p.path, 'no page links here');
582
+ // A source summary is reachable from the index and need not be cited yet; an area guide is found by its area, not by links.
583
+ if (p.data.type !== 'source' && p.data.type !== 'guide' && !p.inbound.some(q => q !== vault.index && q !== vault.log)) add('warn', 'orphan-page', p.path, 'no page links here');
584
584
  }
585
585
  if (p.folder === 'plans') {
586
586
  const id = /-plan$/i.test(p.name) ? p.name.replace(/-plan$/i, '') : null;
@@ -688,6 +688,11 @@ function search(vault, query, limit = 8) {
688
688
  return out.sort((a, b) => b.matched - a.matched || lesson(b) - lesson(a) || b.score - a.score || a.page.path.localeCompare(b.page.path)).slice(0, limit);
689
689
  }
690
690
 
691
+ // The wiki page that tells agents how to work in a task area: `type: guide`, `area: <AREA>`.
692
+ function guideFor(vault, area) {
693
+ return vault.pages.find(p => p.folder === 'wiki' && p.data.type === 'guide' && key(p.data.area ?? '') === key(area)) || null;
694
+ }
695
+
691
696
 
692
697
  // ---------- App. Everything about the vault (frontmatter, links, task state, waves, lint) comes from the core above. ----------
693
698
  (() => {
@@ -79,7 +79,7 @@ keep(join(docs, 'log.md'), `# Log\n\nAppend-only. Entry format: \`## [YYYY-MM-DD
79
79
  write(join(dotdir, '.gitignore'), 'data.js\nserver.json\n');
80
80
  refresh(join(assets, 'sw.mjs'), join(dotdir, 'sw.mjs'));
81
81
  refresh(join(assets, 'viewer.html'), join(docs, 'viewer.html'));
82
- for (const t of ['page.md', ...(tasks ? ['task.md', 'plan.md'] : [])]) refresh(join(assets, 'templates', t), join(dotdir, 'templates', t));
82
+ for (const t of ['page.md', ...(tasks ? ['task.md', 'plan.md', 'guide.md'] : [])]) refresh(join(assets, 'templates', t), join(dotdir, 'templates', t));
83
83
 
84
84
  const config = {
85
85
  version: 1,
@@ -13,8 +13,8 @@ Run everything from the project root. `<skill-dir>` is this skill's directory; `
13
13
 
14
14
  Stop and tell the user if any of these fails; do not work around them.
15
15
 
16
- - The project is a git repository and `git status --porcelain` is empty.
17
- - `docs/.sw/` does not exist (already a vault).
16
+ - The project is a git repository, and `git status --porcelain -- docs AGENTS.md CLAUDE.md` is empty: the files this skill rewrites have no uncommitted changes. Uncommitted changes elsewhere do not block; mention them in the report so the user does not mistake them for the migration's.
17
+ - `docs/.sw/config.json` does not exist (already a vault). Empty folders left by an earlier, undone attempt are not a vault; ignore them.
18
18
  - Node 18 or newer.
19
19
 
20
20
  ## Steps
@@ -5,7 +5,7 @@ description: Use when the user wants to plan a task or a piece of work in a Supe
5
5
 
6
6
  # sw-plan
7
7
 
8
- Produces `docs/plans/<ID>-plan.md` for one task. You clarify with the user and get approval; a planner subagent, running the model set in sw-config, reads the code and writes the plan. Nothing but task and plan files changes during planning.
8
+ Produces `docs/plans/<ID>-plan.md` for one task. You clarify with the user and get approval; a planner subagent, running the model set in sw-config, reads the code and writes the plan file. You never read the code and never hold the plan text: that is what keeps planning cheap.
9
9
 
10
10
  Needs the task module (`docs/tasks/`). If it is missing, say so and offer sw-init with `--tasks`. Run commands from the project root. `<skill-dir>` is the directory this SKILL.md is in.
11
11
 
@@ -15,32 +15,34 @@ Needs the task module (`docs/tasks/`). If it is missing, say so and offer sw-ini
15
15
  - Id given: `node docs/.sw/sw.mjs check <ID>`, then read `docs/tasks/<ID>.md`. Status `done` or `cancelled`: stop and ask what the user wants. A plan already exists: this run revises it; say so. Open deps do not prevent planning.
16
16
  - No id, existing work: `node docs/.sw/sw.mjs ready`, and let the user choose.
17
17
  - New work: agree on title, area and dependencies with the user, get the id from `node docs/.sw/sw.mjs next-id <AREA>`, and write `docs/tasks/<ID>.md` from `docs/.sw/templates/task.md` with `status: todo`, a "Goal" and a "Done when" list. Append `## [date] task | <ID> created` to `docs/log.md`.
18
- 2. **Clarify.** Ask the user only what the task file leaves open about scope or intent, one question at a time, each with your recommendation. Add the answers to the task's "Notes" now. Do not read code to find questions; the planner surfaces the technical ones in step 5. Skip this when nothing is open.
19
- 3. **Enter plan mode** if this tool gives you a way to (Claude Code: `EnterPlanMode`). Otherwise continue. From here on you change no file until step 6.
20
- 4. **Dispatch the planner.** Its prompt is: the task id, today's date, the project root if it is not your working directory, and any feedback from an earlier round. Do not read the code yourself; that is the planner's job and its context, not yours.
18
+ 2. **Does it need a plan?** Judge from the task file alone. A task is small when all of these hold: one area, three "Done when" items or fewer, nothing left open in its notes, and the change it describes is confined to a few files. A small task needs no plan: say so and offer `sw-implement <ID>` directly. Go on with planning only if the user wants a plan anyway, or the task is not small.
19
+ 3. **Clarify.** Ask the user only what the task file leaves open about scope or intent, one question at a time, each with your recommendation. Add the answers to the task's "Notes" now. Do not read code to find questions; the planner surfaces the technical ones. Skip this when nothing is open.
20
+ 4. **Dispatch the planner.** Its prompt is: the task id, today's date, the project root if it is not your working directory, and any feedback from an earlier round. It writes the plan file as a draft and returns a short message.
21
21
 
22
22
  | Tool | How |
23
- |---|---|
24
- | Claude Code | agent `sw-planner`. If it is not among your agent types, use the read-only `Plan` agent, put the content of `<skill-dir>/../sw-config/assets/planner.md` at the top of its prompt, and pass the model from `models.plan.claude` in `docs/.sw/config.json` if set |
23
+ | --- | --- |
24
+ | Claude Code | agent `sw-planner`. If it is not among your agent types, use a general-purpose agent, tell it to read `<skill-dir>/../sw-config/assets/planner.md` first and follow it, and pass the model from `models.plan.claude` in `docs/.sw/config.json` if set |
25
25
  | Codex | spawn the custom agent `sw_planner` |
26
26
  | Copilot CLI | `task` tool with agent `sw-planner` |
27
27
  | No subagents available, or the agent is not defined | follow `planner.md` yourself, in this session, and tell the user the configured model was not used |
28
28
 
29
- 5. **Show the plan and get approval.** Present the approach, the steps and the planner's notes (Claude Code: through `ExitPlanMode`; anywhere else, as a normal message). The planner returns the plan, then a line `=== notes ===`, then its notes.
30
- - Open questions in the notes: ask them, each with the planner's assumed answer as your recommendation. If an answer differs from what the plan assumed, dispatch the planner again with the answers.
31
- - The user wants changes: dispatch the planner again with their feedback.
32
- - The planner says the work needs splitting: propose the tasks; create them (step 1, "New work") only when the user agrees.
33
- 6. **Write**, after approval:
34
- - `docs/plans/<ID>-plan.md`: the text before `=== notes ===`, unchanged. If something in it is wrong, send it back to the planner; do not edit it yourself.
35
- - answers given in step 5: add to the task's "Notes".
36
- - `docs/log.md`: append `## [date] plan | <ID>`, in the layout the log's last entries use.
29
+ 5. **Get approval.** Show the user the planner's `Approach`, its `Questions` (each with the assumed answer as your recommendation) and its `Split`, and name the plan file so they can read it. Do not read the plan file into your own context unless the user asks you about its content. (Claude Code: enter plan mode with `EnterPlanMode` now and present through `ExitPlanMode`, if those tools are available; anywhere else, a normal message.)
30
+ - An answer differs from what the plan assumed, or the user wants changes: dispatch the planner again with the answers or feedback; it revises the file.
31
+ - The planner proposes a split: create the tasks (step 1, "New work") only when the user agrees.
32
+ - The user drops the plan: delete the draft file.
33
+ 6. **Record**, after approval:
34
+ - in the plan file, change `status: draft` to `status: approved`;
35
+ - in the task's "Notes", the answers given in step 5;
36
+ - in the area guide, if `node docs/.sw/sw.mjs explain <ID>` names one, the planner's `Guide:` lines, one line per fact;
37
+ - in `docs/log.md`, a new entry `## [date] plan | <ID>`, in the layout the log's last entries use.
37
38
 
38
39
  Then run `node docs/.sw/sw.mjs lint`.
39
- 7. **Stop.** Do not start implementing. Tell the user the plan is saved and that sw-implement `<ID>` runs it.
40
+ 7. **Stop.** Do not start implementing. Tell the user the plan is approved and that sw-implement `<ID>` runs it.
40
41
 
41
42
  ## Common mistakes
42
43
 
43
- - Exploring the codebase before dispatching. You pay for it twice.
44
- - Writing the plan file before approval.
44
+ - Planning a small task. The plan costs more than the work.
45
+ - Exploring the codebase before dispatching, or reading the plan back. You pay for it twice.
46
+ - Editing the plan yourself. If something in it is wrong, send it back to the planner.
45
47
  - Setting the task to `in-progress`. Planning does not change status.
46
48
  - Planning several tasks in one plan file. One task, one plan; shared design goes to a `type: decision` wiki page that the plans link.