@panaversity/ksor 0.0.0 → 0.0.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.
Files changed (52) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/NOTICE +8 -0
  3. package/README.md +29 -1307
  4. package/dist/cli.d.mts +1 -0
  5. package/dist/cli.mjs +384 -0
  6. package/dist/index.d.mts +34 -0
  7. package/dist/index.mjs +37 -0
  8. package/docs/index.md +53 -0
  9. package/package.json +52 -23
  10. package/templates/LICENSE +23 -0
  11. package/templates/scaffold/.agents/skills/add-sources/SKILL.md +43 -0
  12. package/templates/scaffold/.agents/skills/format-checker/SKILL.md +39 -0
  13. package/templates/scaffold/.agents/skills/format-checker/check.mjs +782 -0
  14. package/templates/scaffold/.agents/skills/intake-interview/SKILL.md +46 -0
  15. package/templates/scaffold/.claude/skills/add-sources/SKILL.md +43 -0
  16. package/templates/scaffold/.claude/skills/format-checker/SKILL.md +39 -0
  17. package/templates/scaffold/.claude/skills/format-checker/check.mjs +782 -0
  18. package/templates/scaffold/.claude/skills/intake-interview/SKILL.md +46 -0
  19. package/templates/scaffold/.gemini/settings.json +5 -0
  20. package/templates/scaffold/.gitattributes +5 -0
  21. package/templates/scaffold/.github/workflows/validate.yml +23 -0
  22. package/templates/scaffold/AGENTS.md +104 -0
  23. package/templates/scaffold/CLAUDE.md +1 -0
  24. package/templates/scaffold/README.md +63 -0
  25. package/templates/scaffold/gitignore +13 -0
  26. package/templates/scaffold/instance.md +26 -0
  27. package/templates/scaffold/knowledge/example.md +23 -0
  28. package/templates/scaffold/package.json +15 -0
  29. package/templates/scaffold/pnpm-lock.yaml +4041 -0
  30. package/templates/scaffold/pnpm-workspace.yaml +19 -0
  31. package/templates/scaffold/system/site/app/(home)/layout.tsx +6 -0
  32. package/templates/scaffold/system/site/app/(home)/page.tsx +83 -0
  33. package/templates/scaffold/system/site/app/api/search/route.ts +11 -0
  34. package/templates/scaffold/system/site/app/docs/[[...slug]]/page.tsx +53 -0
  35. package/templates/scaffold/system/site/app/docs/layout.tsx +24 -0
  36. package/templates/scaffold/system/site/app/global.css +26 -0
  37. package/templates/scaffold/system/site/app/icon.png +0 -0
  38. package/templates/scaffold/system/site/app/layout.tsx +41 -0
  39. package/templates/scaffold/system/site/app/llms-full.txt/route.ts +10 -0
  40. package/templates/scaffold/system/site/app/llms.txt/route.ts +15 -0
  41. package/templates/scaffold/system/site/components/built-with.tsx +18 -0
  42. package/templates/scaffold/system/site/components/mdx.tsx +15 -0
  43. package/templates/scaffold/system/site/lib/layout.shared.tsx +17 -0
  44. package/templates/scaffold/system/site/lib/shared.ts +51 -0
  45. package/templates/scaffold/system/site/lib/source.ts +119 -0
  46. package/templates/scaffold/system/site/next-env.d.ts +6 -0
  47. package/templates/scaffold/system/site/next.config.mjs +32 -0
  48. package/templates/scaffold/system/site/package.json +29 -0
  49. package/templates/scaffold/system/site/postcss.config.mjs +7 -0
  50. package/templates/scaffold/system/site/source.config.ts +35 -0
  51. package/templates/scaffold/system/site/tsconfig.json +35 -0
  52. package/bin/ksor.js +0 -22
@@ -0,0 +1,46 @@
1
+ ---
2
+ name: intake-interview
3
+ description: The first conversation with the owner of this Knowledge System of Record — five questions that define what it is authoritative for, 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.1.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 five 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
+
34
+ ## Then write
35
+
36
+ - Rewrite `instance.md`'s body from the answers: first the `# H1` — the
37
+ record's **display title**, the human name every page will lead with
38
+ ("Acme Operations Handbook", not the slug) — then the authority sentence,
39
+ boundary, audience, and strictness — plain prose, written for a reader
40
+ who must act on it. Do not touch the frontmatter keys.
41
+ - Restart `pnpm dev` afterwards so the site picks the new title up, and
42
+ show the owner their name on the page.
43
+ - Offer to capture the source list from question 4 as the first real
44
+ documents (the add-sources skill takes it from there).
45
+ - Read the result back to the owner and get an explicit yes before
46
+ finishing. Their words, tightened — never your invention.
@@ -0,0 +1,5 @@
1
+ {
2
+ "context": {
3
+ "fileName": ["AGENTS.md", "GEMINI.md"]
4
+ }
5
+ }
@@ -0,0 +1,5 @@
1
+ # Checkout bytes are provenance bytes: markdown is LF on every platform so
2
+ # the same commit hashes identically on Windows, macOS, and Linux.
3
+ * text=auto
4
+ *.md text eol=lf
5
+ instance.md text eol=lf
@@ -0,0 +1,23 @@
1
+ name: Validate knowledge
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ permissions:
9
+ contents: read
10
+
11
+ jobs:
12
+ check:
13
+ name: Format checker
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
17
+ with:
18
+ persist-credentials: false
19
+ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
20
+ with:
21
+ node-version: "24"
22
+ # The checker is dependency-free Node — no install step needed.
23
+ - run: node .agents/skills/format-checker/check.mjs
@@ -0,0 +1,104 @@
1
+ # AGENTS.md
2
+
3
+ The working contract for this Knowledge System of Record. CLAUDE.md points
4
+ here; every coding agent reads this file first.
5
+
6
+ ## The two worlds
7
+
8
+ | Path | What it is |
9
+ | ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
+ | `knowledge/` | **the record** — governed markdown, the owner's world, the product |
11
+ | `system/` | **the system** — all code that serves the record |
12
+ | `instance.md` | what this SoR is authoritative for; its prose is the future agent surface's system prompt. Its `name:` is the machine identity (llms.txt, future citations) and its body `# H1` is the DISPLAY TITLE every page leads with — both read when the server or build STARTS, so restart `pnpm dev` after changing either (found live 2026-08-18) |
13
+
14
+ The record survives the system: `knowledge/` must stay readable and complete
15
+ even if `system/` is deleted. Dependency flows one way — the system reads the
16
+ record; the record never references the system.
17
+
18
+ `instance.md` carries a closed key set — `format`, `name`, `ksor`, `site` —
19
+ and everything that matters about it is the prose below that frontmatter;
20
+ `pnpm check` names any other key rather than ignoring it.
21
+
22
+ ## Critical rules
23
+
24
+ 1. **The site never contains authored content.** Knowledge goes in
25
+ `knowledge/`, always. Never create markdown, MDX, or content pages inside
26
+ `system/site` — the site _renders_ the record, it never _holds_ it.
27
+ 2. **`knowledge/` is CommonMark `.md` only.** No `.mdx`, no `meta.json`, no
28
+ framework files. A document must read cleanly in any markdown viewer.
29
+ 3. **Never edit generated files** — `system/site/.source/`, `.next/`, `out/`,
30
+ lockfiles by hand.
31
+
32
+ ## Commands (run at the repo root)
33
+
34
+ ```sh
35
+ pnpm install # once, after cloning or scaffolding
36
+ pnpm dev # the site, hot-reloading, at http://localhost:3000
37
+ pnpm build # static site into system/site/out/
38
+ pnpm check # the format checker — run before handing off any knowledge change
39
+ ```
40
+
41
+ ## Writing knowledge
42
+
43
+ - One document per file under `knowledge/`; the path is the document's
44
+ identity and its URL — ascii lowercase, digits, hyphens; no spaces or
45
+ special characters; no two files differing only in case; never both
46
+ `foo.md` and `foo/index.md`. The `title:` carries the document's real
47
+ name in any language — the filename is the address, not the name.
48
+ - The frontmatter `title` IS the rendered page heading — never repeat it as
49
+ an `# h1` in the body, and quote any value containing a colon
50
+ (`title: "Note: quoting"`).
51
+ - Frontmatter: `title` and `status` (`draft | review | approved | superseded`)
52
+ are required. `owner` and `provenance` (a list naming real sources) are
53
+ strongly encouraged — they become required as this project climbs the
54
+ governance ladder. `description`, `order` (sidebar position), `effective`
55
+ (the date the document takes effect) and `superseded` (a legacy marker —
56
+ prefer `status`) are available. No other keys; never `id:` or `name:` — the
57
+ path is the identity.
58
+ - A replaced document is marked `status: superseded` with `superseded_by:`
59
+ pointing at its successor — superseded documents are never deleted.
60
+ - Images and assets live in `knowledge/` beside the document that uses them,
61
+ referenced by relative links. A relative link must never leave `knowledge/`.
62
+ - Copy load-bearing values (numbers, thresholds, dates) exactly from their
63
+ source, and name the source in `provenance`.
64
+
65
+ ### Structuring the record
66
+
67
+ - A folder per topic; its front page is `<folder>/index.md`, and the folder
68
+ takes the position that page declares.
69
+ - Sidebar position is the governed `order:` key: documents that declare it come
70
+ first, ascending; the rest follow in name order.
71
+ - One order drives the sidebar, `llms.txt`, and the home page's first-document
72
+ link — set it once and every surface agrees.
73
+ - Never `meta.json` or `sidebar_position`: the checker refuses framework files
74
+ in the record, which has to read the same without the site.
75
+
76
+ ## Skills
77
+
78
+ - `.agents/skills/intake-interview/` — first run: interview the owner and
79
+ write `instance.md` together.
80
+ - `.agents/skills/add-sources/` — turn source material (documents, pages,
81
+ notes) into governed knowledge.
82
+ - `.agents/skills/format-checker/` — the rules above, as a program;
83
+ `pnpm check` runs it and its errors explain how to fix themselves.
84
+
85
+ ## Customizing the site
86
+
87
+ You own `system/site/` outright — these are the seams, cheapest first:
88
+
89
+ - **Display title** — `instance.md`'s body `# H1` (the intake interview
90
+ writes it). Headline, navbar, and browser title follow on restart.
91
+ - **Accent color** — the one brand pair in `system/site/app/global.css`
92
+ (`--color-fd-primary`, light and dark); every accented element follows.
93
+ - **Logo and favicon** — replace `system/site/app/icon.png`; the tab icon
94
+ and the home-page mark are the same file.
95
+ - **Anything deeper** — edit the site like the Next.js app it is; the only
96
+ rule that survives customization is critical rule 1. The whole shell is
97
+ replaceable behind a four-clause contract (a themed Docusaurus shell with
98
+ a swap recipe lives in the ksor repository under `workbench/shells/`).
99
+
100
+ ## What this project owns
101
+
102
+ Everything. The scaffold was emitted by `ksor init` (version recorded in
103
+ `instance.md`) and belongs to this repository outright — change anything in
104
+ `system/` deliberately; the knowledge in `knowledge/` was always yours.
@@ -0,0 +1 @@
1
+ @AGENTS.md
@@ -0,0 +1,63 @@
1
+ # KSOR-STAMP-NAME
2
+
3
+ A **Knowledge System of Record**: the governed source of knowledge this
4
+ project's people and AI agents operate from.
5
+
6
+ Two worlds live here:
7
+
8
+ - **`knowledge/` — the record.** Plain governed markdown. Yours forever,
9
+ readable anywhere, portable without this repository's code.
10
+ - **`system/` — the system.** The site (and later, services) that serve the
11
+ record. Replaceable machinery.
12
+
13
+ ## Working here
14
+
15
+ ```sh
16
+ pnpm install
17
+ pnpm dev # browse the knowledge at http://localhost:3000
18
+ ```
19
+
20
+ No pnpm? Run `npm install -g pnpm` — or `corepack enable pnpm` on Node
21
+ versions that bundle corepack.
22
+
23
+ Then talk to your coding agent — `AGENTS.md` carries the working rules, and
24
+ the agent kit in `.agents/skills/` knows how to interview you
25
+ (`intake-interview`), convert your source material (`add-sources`), and keep
26
+ the record well-formed (`format-checker`, also `pnpm check`).
27
+
28
+ ## The files, explained
29
+
30
+ Nothing here is decoration, and the dotfiles are not ceremony — each one is a
31
+ different coding agent's way of finding the same working contract.
32
+
33
+ | Entry | What it is |
34
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
35
+ | `knowledge/` | **the record** — your governed markdown. The product; everything else serves it. |
36
+ | `system/` | the code that serves the record: the site today, more as you need it. |
37
+ | `instance.md` | what this record is authoritative for; its `name:` is the identity every surface publishes (read at server/build start — restart `pnpm dev` after renaming). When the agent surface ships, this prose becomes its system prompt. |
38
+ | `AGENTS.md` | the working contract every coding agent reads first — the rules for writing knowledge here. |
39
+ | `CLAUDE.md` | one line, pointing at `AGENTS.md`. Claude Code looks for this filename, not that one. |
40
+ | `.agents/skills/` | the agent kit: `intake-interview` (define the record with you), `add-sources` (turn source material into governed documents), `format-checker` (the rules, as a program). |
41
+ | `.claude/skills/` | byte-identical copies of the kit — Claude Code discovers skills only here. The checker enforces the mirror, so the two cannot drift. |
42
+ | `.gemini/settings.json` | points Gemini CLI at `AGENTS.md`; Gemini does not read that filename on its own. |
43
+ | `.github/workflows/validate.yml` | your CI: runs the same checker on every pull request and push to main. |
44
+ | `.gitattributes` | markdown is checked out byte-stable on every platform, so the same commit hashes the same everywhere. |
45
+ | `.gitignore` | keeps build output, `node_modules/`, and `.env*` out of the record's history. |
46
+ | `package.json` | the `pnpm dev` / `pnpm build` / `pnpm check` commands, and the pnpm version this project pins. |
47
+ | `pnpm-workspace.yaml` | where the workspace looks for code (`system/site`, plus reserved `system/gateways/*` and `system/packages/*`), and the supply-chain policy for installs. |
48
+ | `pnpm-lock.yaml` | the exact dependency versions — the reason two machines build the same site. |
49
+
50
+ `format-checker` deliberately contains a program, `check.mjs`, and not only
51
+ prose: rules that are only written down cannot refuse anything. `pnpm check`
52
+ runs it, and every failure it reports says what is wrong, why the rule exists,
53
+ and how to fix it.
54
+
55
+ Everything here is yours to change. The kit exists so that any coding agent can
56
+ operate this project without being taught it first.
57
+
58
+ ## Ownership
59
+
60
+ Everything here is yours. The scaffold was generated by
61
+ [ksor](https://github.com/panaversity/ksor) (version in `instance.md`) and is
62
+ granted without attribution or licence obligations; your knowledge was never
63
+ anyone else's to license.
@@ -0,0 +1,13 @@
1
+ # scratch space for ksor verbs — everything transient lives under one roof
2
+ .ksor/
3
+
4
+ node_modules/
5
+ system/site/.next/
6
+ system/site/.source/
7
+ system/site/out/
8
+ *.tsbuildinfo
9
+
10
+ # secrets never enter the record — system/ is their future home (serve)
11
+ .env*
12
+
13
+ .DS_Store
@@ -0,0 +1,26 @@
1
+ ---
2
+ format: 1
3
+ name: KSOR-STAMP-NAME
4
+ ksor:
5
+ requires: ">=KSOR-STAMP-VERSION"
6
+ scaffolded: "KSOR-STAMP-VERSION"
7
+ ---
8
+
9
+ # Knowledge System of Record
10
+
11
+ The heading above is this record's **display title** — the human name every
12
+ page leads with. The intake interview replaces it with the real one
13
+ ("Acme Operations Handbook"); the machine identity stays `KSOR-STAMP-NAME`
14
+ in the frontmatter, and that is what agents and citations use.
15
+
16
+ This Knowledge System of Record is authoritative for — _fill this in; it is
17
+ the single most important sentence in the project._
18
+
19
+ Everything below this frontmatter is the identity of this instance: what the
20
+ corpus covers, who it serves, and how strictly it should decline questions it
21
+ does not cover. When the agent surface ships, this prose becomes its system
22
+ prompt — write it for a reader who must act on it.
23
+
24
+ Ask your coding agent to run the **intake interview** (it knows how — see
25
+ `.agents/skills/intake-interview/`), answer its questions, and let it write
26
+ this document with you.
@@ -0,0 +1,23 @@
1
+ ---
2
+ title: Your first governed document
3
+ status: draft
4
+ order: 1
5
+ ---
6
+
7
+ This file exists so the record is never empty: browse it with `pnpm dev`,
8
+ then replace it with real knowledge.
9
+
10
+ A governed document is plain markdown with a small frontmatter header. This
11
+ one carries the two required keys — `title` and `status: draft`. As the
12
+ knowledge matures, documents gain `owner` and `provenance` (who stands behind
13
+ this, and which sources it came from), move to `status: approved`, and — when
14
+ replaced — are marked `superseded`, never deleted.
15
+
16
+ It also carries `order: 1`, which is how the record decides reading order: a
17
+ document that declares `order` sorts ahead of every document that does not, so
18
+ this one stays first in the sidebar, first in `llms.txt`, and the document the
19
+ home page opens.
20
+
21
+ Ask your coding agent to run the **intake interview** to define what this
22
+ Knowledge System of Record is authoritative for, then start adding documents
23
+ with the **add-sources** skill. `pnpm check` keeps every document honest.
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "KSOR-STAMP-NAME",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "pnpm -C system/site dev",
8
+ "build": "pnpm -C system/site build",
9
+ "check": "node .agents/skills/format-checker/check.mjs"
10
+ },
11
+ "engines": {
12
+ "node": ">=24"
13
+ },
14
+ "packageManager": "pnpm@11.22.0"
15
+ }