@panaversity/ksor 0.0.1 → 0.0.3

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +24 -6
  3. package/dist/cli.mjs +345 -2
  4. package/docs/index.md +38 -6
  5. package/package.json +3 -1
  6. package/templates/LICENSE +23 -0
  7. package/templates/scaffold/.agents/skills/add-sources/SKILL.md +46 -0
  8. package/templates/scaffold/.agents/skills/format-checker/SKILL.md +46 -0
  9. package/templates/scaffold/.agents/skills/format-checker/check.mjs +991 -0
  10. package/templates/scaffold/.agents/skills/intake-interview/SKILL.md +61 -0
  11. package/templates/scaffold/.claude/skills/add-sources/SKILL.md +46 -0
  12. package/templates/scaffold/.claude/skills/format-checker/SKILL.md +46 -0
  13. package/templates/scaffold/.claude/skills/format-checker/check.mjs +991 -0
  14. package/templates/scaffold/.claude/skills/intake-interview/SKILL.md +61 -0
  15. package/templates/scaffold/.gemini/settings.json +5 -0
  16. package/templates/scaffold/.gitattributes +5 -0
  17. package/templates/scaffold/.github/workflows/validate.yml +23 -0
  18. package/templates/scaffold/AGENTS.md +133 -0
  19. package/templates/scaffold/CLAUDE.md +1 -0
  20. package/templates/scaffold/README.md +90 -0
  21. package/templates/scaffold/gitignore +16 -0
  22. package/templates/scaffold/instance.md +26 -0
  23. package/templates/scaffold/knowledge/example.md +23 -0
  24. package/templates/scaffold/package.json +15 -0
  25. package/templates/scaffold/pnpm-lock.yaml +4041 -0
  26. package/templates/scaffold/pnpm-workspace.yaml +19 -0
  27. package/templates/scaffold/system/site/app/(home)/layout.tsx +6 -0
  28. package/templates/scaffold/system/site/app/(home)/page.tsx +83 -0
  29. package/templates/scaffold/system/site/app/api/search/route.ts +11 -0
  30. package/templates/scaffold/system/site/app/docs/[[...slug]]/page.tsx +53 -0
  31. package/templates/scaffold/system/site/app/docs/layout.tsx +24 -0
  32. package/templates/scaffold/system/site/app/global.css +26 -0
  33. package/templates/scaffold/system/site/app/icon.png +0 -0
  34. package/templates/scaffold/system/site/app/layout.tsx +41 -0
  35. package/templates/scaffold/system/site/app/llms-full.txt/route.ts +10 -0
  36. package/templates/scaffold/system/site/app/llms.txt/route.ts +15 -0
  37. package/templates/scaffold/system/site/components/built-with.tsx +18 -0
  38. package/templates/scaffold/system/site/components/footer-mark.tsx +22 -0
  39. package/templates/scaffold/system/site/components/mdx.tsx +15 -0
  40. package/templates/scaffold/system/site/lib/audience.ts +178 -0
  41. package/templates/scaffold/system/site/lib/layout.shared.tsx +17 -0
  42. package/templates/scaffold/system/site/lib/shared.ts +60 -0
  43. package/templates/scaffold/system/site/lib/source.ts +119 -0
  44. package/templates/scaffold/system/site/lib/stage-knowledge.ts +301 -0
  45. package/templates/scaffold/system/site/next-env.d.ts +6 -0
  46. package/templates/scaffold/system/site/next.config.mjs +32 -0
  47. package/templates/scaffold/system/site/package.json +29 -0
  48. package/templates/scaffold/system/site/postcss.config.mjs +7 -0
  49. package/templates/scaffold/system/site/source.config.ts +41 -0
  50. package/templates/scaffold/system/site/tsconfig.json +35 -0
  51. package/templates/scaffold/vercel.json +8 -0
@@ -0,0 +1,61 @@
1
+ ---
2
+ name: intake-interview
3
+ description: The first conversation with the owner of this Knowledge System of Record — six questions that define what it is authoritative for and who may read it, then write instance.md together. Use when the owner asks to set up, configure, or "get started with" this project, when instance.md still contains its scaffold placeholder text, or when the scope of the corpus is unclear.
4
+ metadata:
5
+ version: "1.2.0"
6
+ ---
7
+
8
+ # Intake interview
9
+
10
+ `instance.md` is the identity of this Knowledge System of Record, and its
11
+ prose will one day be the agent surface's system prompt. Do not draft it from
12
+ guesses — interview the owner, one question at a time, and write down what
13
+ they actually say.
14
+
15
+ ## The six questions
16
+
17
+ Ask these one at a time; follow up until each answer is concrete enough to
18
+ act on:
19
+
20
+ 1. **Authority** — "What should this record be the _final word_ on? Finish
21
+ the sentence: when someone here disagrees with this corpus, the corpus
22
+ wins about ___."
23
+ 2. **Boundary** — "What is explicitly _outside_ it — near-miss topics people
24
+ will ask about that this record should refuse rather than guess at?"
25
+ 3. **Audience** — "Who reads it — people, agents, both? In what situations,
26
+ making what decisions?"
27
+ 4. **Sources** — "Which existing materials are authoritative inputs (name
28
+ the actual documents, systems, people), and which are explicitly _not_
29
+ trusted?"
30
+ 5. **Strictness** — "When the record doesn't cover a question, how firmly
31
+ should it decline? ('Not in this corpus' is a correct answer here —
32
+ confirm the owner wants that behavior and where they want it softened.)"
33
+ 6. **Audiences** — "Does every reader of this record see every document? If
34
+ not, what are the audiences, from most public to most restricted?" A yes
35
+ is the common answer and the whole answer: write no `audiences:` key and
36
+ nothing about the project changes. A list means writing it into
37
+ `instance.md`'s frontmatter — ordered least- to most-restricted with
38
+ `public` first, plus `default_visibility:` naming the audience a document
39
+ takes when it says nothing (there is no safe guess, so the checker
40
+ requires it). Tell the owner what the key does and does not do:
41
+ documents carry `visibility:` and builds are made per audience, but
42
+ anyone who can clone the repository reads everything in it — if someone
43
+ must not read a document and can clone, that document belongs in a
44
+ different repository.
45
+
46
+ ## Then write
47
+
48
+ - Rewrite `instance.md`'s body from the answers: first the `# H1` — the
49
+ record's **display title**, the human name every page will lead with
50
+ ("Acme Operations Handbook", not the slug) — then the authority sentence,
51
+ boundary, audience, and strictness — plain prose, written for a reader
52
+ who must act on it. Leave the frontmatter keys alone, with one exception:
53
+ an audience model from question 6 is written there as `audiences:` (a
54
+ list) and `default_visibility:`, and `pnpm check` will hold the record to
55
+ it from that moment on.
56
+ - Restart `pnpm dev` afterwards so the site picks the new title up, and
57
+ show the owner their name on the page.
58
+ - Offer to capture the source list from question 4 as the first real
59
+ documents (the add-sources skill takes it from there).
60
+ - Read the result back to the owner and get an explicit yes before
61
+ finishing. Their words, tightened — never your invention.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: add-sources
3
+ description: Turn source material — documents, pages, pasted text, notes — into governed knowledge in knowledge/. Use when the owner shares material to add, says "add this to the knowledge base", or asks how to get existing content in. Not for editing the site.
4
+ metadata:
5
+ version: "1.2.0"
6
+ ---
7
+
8
+ # Add sources
9
+
10
+ Converting material into the record is the everyday work of this project.
11
+ The rules that make it _governed_ rather than merely stored:
12
+
13
+ ## Placement and shape
14
+
15
+ - One document per topic, under `knowledge/`, path = identity: lowercase,
16
+ hyphens, a folder per natural grouping. Plain CommonMark `.md` — if the
17
+ source is rich (tables, images), tables become markdown tables and images
18
+ land _beside the document_ with relative links.
19
+ - A folder's front page is `<folder>/index.md`; reading order is the
20
+ `order:` frontmatter key (ordered documents first, ascending; the rest
21
+ follow alphabetically) — never `meta.json` or `sidebar_position`.
22
+ - Frontmatter: `title` and `status: draft` always; add `owner` (who stands
23
+ behind this content) and `provenance` (a list naming the actual sources —
24
+ file names, systems, people, dates) whenever the owner can tell you.
25
+ Precision matters: "Finance policy manual §4.2, 2025 edition" governs;
26
+ "internal docs" does not.
27
+ - When `instance.md` declares `audiences:`, ask the owner which audience the
28
+ new material belongs to and write it as `visibility:` — never guess that
29
+ restricted material is public.
30
+
31
+ ## Fidelity rules
32
+
33
+ - **Copy load-bearing values exactly** — numbers, thresholds, dates, names.
34
+ Never round, never paraphrase a figure.
35
+ - **Two disagreeing sources stay two statements**, each with its provenance
36
+ — never smooth a conflict into one invented truth; flag it to the owner.
37
+ - **Do not fill gaps from general knowledge.** If the source doesn't cover
38
+ something, the record doesn't either — that boundary is the product.
39
+ - A document replacing an older one: mark the old one `status: superseded`
40
+ with `superseded_by:` pointing at the new — never delete it.
41
+
42
+ ## Finish every batch
43
+
44
+ Run `pnpm check` and fix what it reports (its errors explain themselves),
45
+ then show the owner the rendered result (`pnpm dev`) — the site is the
46
+ review surface: you write, they check.
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: format-checker
3
+ description: The record's format rules as a runnable check — frontmatter, filenames, links, structure. Use before handing off any change to knowledge/, when a check fails and you need to fix it, or when unsure whether a document is well-formed. Run with `pnpm check` (or node .agents/skills/format-checker/check.mjs).
4
+ metadata:
5
+ version: "1.2.0"
6
+ ---
7
+
8
+ # Format checker
9
+
10
+ `pnpm check` runs `check.mjs` — dependency-free Node, owned by this repo. It
11
+ enforces what AGENTS.md states in prose:
12
+
13
+ - `knowledge/` holds CommonMark `.md` and images only — no `.mdx`, no
14
+ `meta.json`, no other file types — and it is never empty; a record with no
15
+ documents stands behind nothing.
16
+ - Every document carries `title` + `status` (level-0 requirement); the full
17
+ allowed key set is closed; a `superseded` document names a `superseded_by`
18
+ that resolves to a document that exists.
19
+ - Filenames are portable identities: lowercase, Windows-safe, no spaces, no
20
+ case-collisions, no `foo.md` + `foo/index.md` pairs, no parentheses.
21
+ (`.DS_Store` and friends are skipped, never reported.)
22
+ - Relative links resolve and never leave `knowledge/` — inline,
23
+ `<angle-bracketed>`, and reference-style (`[text][label]` with its
24
+ `[label]: target` definition) alike. Links inside code spans and fenced
25
+ blocks are code, not links, and are ignored.
26
+ - `instance.md` exists, is `format: 1`, and carries only the keys the format
27
+ defines — an unknown key is named, never ignored.
28
+ - The audience model, when there is one: `audiences:` is ordered least- to
29
+ most-restricted with `public` first, no duplicates, and never without
30
+ `default_visibility:`; a document's `visibility:` names one of the declared
31
+ audiences; and no link or `superseded_by:` points from a wider audience at a
32
+ narrower one — the leak no single build can catch, since the build that
33
+ publishes the pointer has already dropped its target. A record that declares
34
+ no `audiences:` is checked exactly as it was before the key existed.
35
+ - `CLAUDE.md` stays a one-line pointer; `.agents/skills/` and
36
+ `.claude/skills/` hold the same files byte for byte **in both directions**
37
+ (a file only one tree carries is a rule nobody reviewed); the site contains
38
+ no content files.
39
+
40
+ Every failure prints what is wrong, why the rule exists, and the fix — obey
41
+ the printed fix literally; if it doesn't resolve the problem, that is a bug
42
+ worth reporting to ksor.
43
+
44
+ When you edit any skill under `.agents/skills/`, re-copy it to
45
+ `.claude/skills/` — the checker holds the two trees identical, and it now
46
+ notices a file added on either side.