mlx-bun 0.0.8 → 0.0.9
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/README.md +112 -20
- package/docs/design/batching-v2-plan.md +515 -0
- package/docs/design/bucketing-stage.md +196 -0
- package/docs/design/compat-cli-surface-design.md +11 -11
- package/docs/design/docs-reorg-plan.md +1 -1
- package/docs/design/dreaming-nightly-pipeline.md +291 -0
- package/docs/design/dspark-speculative-decoding.md +106 -0
- package/docs/design/generic-model-support.md +381 -0
- package/docs/design/memory-inference-path.md +422 -0
- package/docs/design/memory-synthesis.md +287 -0
- package/docs/design/minicpm5-decode-megakernel.md +484 -0
- package/docs/design/mlx-lm-tool-parity-plan.md +535 -0
- package/docs/design/orpo-dynamic-lambda.md +41 -0
- package/docs/design/orpo-training.md +35 -5
- package/docs/design/parallel-slots.md +12 -1
- package/docs/design/parity-tier-dag.md +13 -5
- package/docs/design/spec-decode-larger-targets.md +229 -0
- package/docs/design/tauri-desktop-app.md +2 -2
- package/docs/design/the-dreaming-handoff.md +141 -0
- package/docs/design/the-dreaming-master-plan.md +446 -0
- package/docs/design/write-pipeline-entity.md +468 -0
- package/docs/investigations/curve-bisector-routing.md +1 -1
- package/docs/investigations/decode-roofline-lookagain.md +262 -0
- package/docs/investigations/dspark-handoff.md +58 -0
- package/docs/investigations/kernel-perf-review-2026-07.md +92 -0
- package/docs/planning/PRODUCT_ROADMAP.md +2 -2
- package/docs/planning/curve-sampler-research-plan.md +331 -0
- package/docs/planning/memory-docs-and-dag-plan.md +185 -0
- package/docs/planning/pi-integration-review.md +178 -0
- package/docs/planning/release-notes-v0.0.9.md +122 -0
- package/docs/planning/web-ui-pass-plan.md +213 -0
- package/docs/planning/website-readme-pass-plan.md +224 -0
- package/docs/reference/cli.md +255 -0
- package/docs/reference/embedding.md +7 -2
- package/docs/reference/library-api.md +22 -3
- package/docs/reference/memory.md +5 -5
- package/docs/reference/models.md +137 -0
- package/docs/reference/orpo-quickstart.md +6 -0
- package/docs/reference/server-api.md +187 -9
- package/docs/reference/server-config.md +40 -9
- package/docs/reference/training.md +25 -11
- package/package.json +1 -1
- package/src/anthropic.ts +22 -0
- package/src/assets/curve-designer.html +1 -1
- package/src/chat-template.ts +25 -7
- package/src/cli.ts +1029 -86
- package/src/config.ts +4 -1
- package/src/download.ts +99 -8
- package/src/embed.ts +77 -0
- package/src/eval/perplexity.ts +164 -0
- package/src/eval/runner.ts +15 -6
- package/src/eval/tasks/bfcl.ts +1 -1
- package/src/generate.ts +141 -18
- package/src/harness-pi.ts +43 -17
- package/src/index.ts +2 -0
- package/src/lora.ts +2 -2
- package/src/memory/article.ts +558 -0
- package/src/memory/chunk-validation.ts +150 -0
- package/src/memory/chunk.ts +305 -12
- package/src/memory/cluster.ts +344 -17
- package/src/memory/coverage.ts +134 -0
- package/src/memory/crosslink.ts +0 -0
- package/src/memory/db.ts +184 -45
- package/src/memory/entity.ts +203 -0
- package/src/memory/gate.ts +187 -0
- package/src/memory/history.ts +152 -0
- package/src/memory/ingest.ts +324 -11
- package/src/memory/model.ts +321 -0
- package/src/memory/normalize.ts +671 -0
- package/src/memory/parse.ts +22 -0
- package/src/memory/pipeline.ts +242 -30
- package/src/memory/prompts.ts +42 -0
- package/src/memory/query.ts +334 -0
- package/src/memory/reconcile.ts +734 -0
- package/src/memory/redirect.ts +108 -0
- package/src/memory/reindex.ts +325 -0
- package/src/memory/resolve.ts +307 -0
- package/src/memory/route.ts +272 -0
- package/src/memory/schedule.ts +6 -4
- package/src/memory/stages.ts +774 -0
- package/src/memory/synthesize.ts +1629 -20
- package/src/memory/tools.ts +446 -96
- package/src/memory/vault.ts +462 -35
- package/src/memory/wikify.ts +1057 -16
- package/src/mlx/ffi.ts +3 -0
- package/src/mlx/ops.ts +46 -0
- package/src/model/compiled-decode.ts +43 -8
- package/src/model/factory.ts +29 -8
- package/src/model/flash-attention.ts +4 -2
- package/src/model/fused-decode-kernel.ts +14 -7
- package/src/model/fused-mlp-kernel.ts +169 -0
- package/src/model/fused-swiglu-kernel.ts +240 -0
- package/src/model/gemma4-base.ts +62 -6
- package/src/model/gemma4.ts +33 -2
- package/src/model/minicpm5.ts +106 -8
- package/src/model/qwen3.ts +276 -0
- package/src/model/steel-linear-kernel.ts +96 -0
- package/src/model/support.ts +38 -8
- package/src/model/universal/archs.ts +332 -0
- package/src/model/universal/dense.ts +576 -0
- package/src/model/universal/modules.ts +163 -0
- package/src/model/universal/rope.ts +366 -0
- package/src/pi-provider.ts +1 -1
- package/src/pi-terminal.ts +29 -8
- package/src/pi-web.ts +19 -2
- package/src/quantize/config-writer.ts +1 -1
- package/src/registry.ts +215 -7
- package/src/responses.ts +23 -0
- package/src/sampler.ts +220 -9
- package/src/serve/batch-scheduler.ts +272 -80
- package/src/serve/generation-gateway.ts +86 -18
- package/src/server.ts +612 -49
- package/src/spec/drafter.ts +81 -49
- package/src/spec/dspark/data-dflash.ts +156 -0
- package/src/spec/dspark/data.ts +201 -0
- package/src/spec/dspark/generate-dflash.ts +193 -0
- package/src/spec/dspark/generate.ts +290 -0
- package/src/spec/dspark/loss.ts +213 -0
- package/src/spec/dspark/module-dflash.ts +361 -0
- package/src/spec/dspark/module.ts +540 -0
- package/src/spec/dspark/sample.ts +112 -0
- package/src/spec/generate.ts +40 -19
- package/src/status-page.html +1 -1
- package/src/tokenizer.ts +7 -0
- package/src/train/flash-cce.ts +70 -15
- package/src/train/fuse.ts +243 -0
- package/src/train/index.ts +3 -0
- package/src/train/job.ts +8 -0
- package/src/train/loss.ts +289 -30
- package/src/train/prefix-shared.ts +33 -5
- package/src/train/segmented.ts +67 -11
- package/src/train/trainer.ts +92 -28
- package/src/web/skills/memory/SKILL.md +40 -17
package/src/memory/vault.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { access, lstat, mkdir, readdir, readFile, readlink, stat, symlink, unlin
|
|
|
18
18
|
import { homedir } from "node:os";
|
|
19
19
|
import { isAbsolute, join } from "node:path";
|
|
20
20
|
import { spawn } from "node:child_process";
|
|
21
|
+
import { isFenceLine } from "./article";
|
|
21
22
|
|
|
22
23
|
// ---- paths -----------------------------------------------------------
|
|
23
24
|
|
|
@@ -87,10 +88,6 @@ export function countSubstringOccurrences(text: string, needle: string, caseSens
|
|
|
87
88
|
return count;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
function isFenceLine(line: string): boolean {
|
|
91
|
-
return /^```/.test(line);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
91
|
/** Heading outside fences; depth 1 = `#`, … 6 = `######`. */
|
|
95
92
|
function parseHeadingLine(line: string): { depth: number; title: string } | null {
|
|
96
93
|
const m = /^(#{1,6})\s+(.+)$/.exec(line);
|
|
@@ -465,58 +462,265 @@ Nothing here ever leaves your machine.
|
|
|
465
462
|
|
|
466
463
|
const EDITORIAL_GUIDELINES = `# Editorial Guidelines
|
|
467
464
|
|
|
468
|
-
This wiki follows Wikipedia's editorial conventions except as noted. When
|
|
469
|
-
doubt, do what Wikipedia would do.
|
|
465
|
+
This wiki follows Wikipedia's editorial conventions except as noted below. When
|
|
466
|
+
in doubt, do what Wikipedia would do.
|
|
470
467
|
|
|
471
468
|
## Scope adaptations for a personal wiki
|
|
472
469
|
|
|
473
|
-
- **Subject**: you. Articles describe the people, projects, ideas,
|
|
474
|
-
topics relevant to your thinking.
|
|
470
|
+
- **Subject**: the user (you). Articles describe the people, projects, ideas,
|
|
471
|
+
tools, and topics relevant to your thinking.
|
|
475
472
|
- **Sources**: your conversation transcripts with the local assistant. Each
|
|
476
473
|
article cites the conversations that contributed to it (\`conv:HASH\`).
|
|
477
474
|
- **Neutral point of view**: adapted. The wiki represents your actual views and
|
|
478
475
|
reasoning. "Neutral" here means faithful to the evidence in your
|
|
479
476
|
conversations, not pretending to be from no perspective.
|
|
480
477
|
- **Notability**: anything that recurs in your thinking is notable enough. Stub
|
|
481
|
-
articles are encouraged for emerging topics.
|
|
478
|
+
articles are encouraged for emerging topics. There is no ownership or
|
|
479
|
+
usefulness test — a subject earns an article by being something you actually
|
|
480
|
+
think about, not by being something you own.
|
|
481
|
+
- **Conflict of interest**: not applicable — this is a single-subject wiki you
|
|
482
|
+
own.
|
|
482
483
|
|
|
483
|
-
##
|
|
484
|
+
## Articles are subjects
|
|
484
485
|
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
486
|
+
Each article is named for ONE specific subject — the actual person, project,
|
|
487
|
+
idea, tool, or topic (one concrete named subject per article, drawn from the
|
|
488
|
+
conversation — never a generic placeholder), never a mixed \`X_and_Y\` topic bin. When a chunk is about several subjects it fans out to
|
|
489
|
+
each subject's article, and routing (see \`Bucketing.md\`) strongly prefers an
|
|
490
|
+
existing subject article over minting a new one. This subject-per-article shape
|
|
491
|
+
is the one deliberate improvement over the source wiki.
|
|
490
492
|
|
|
491
|
-
|
|
493
|
+
## Article structure
|
|
494
|
+
|
|
495
|
+
See \`Article_Conventions.md\`.
|
|
496
|
+
|
|
497
|
+
## Runs on local AI
|
|
498
|
+
|
|
499
|
+
Synthesis runs entirely on a small local model. Every editorial judgment is
|
|
500
|
+
decomposed into the smallest single-purpose task — ideally a binary ("does this
|
|
501
|
+
chunk update this section? yes/no") — so the model stays within its competence
|
|
502
|
+
and the work is cheap to repeat. The policy is the same one a cloud editor would
|
|
503
|
+
follow; only the execution is decomposed.
|
|
504
|
+
|
|
505
|
+
## Maintenance disposition
|
|
492
506
|
|
|
493
|
-
|
|
507
|
+
Synthesis operates as a Wikipedia editor making small, conservative
|
|
508
|
+
contributions. Edits integrate rather than replace. Trajectories ("used to think
|
|
509
|
+
X, now thinks Y") are preserved. Talk pages surface concerns rather than silently
|
|
510
|
+
resolving them.
|
|
511
|
+
|
|
512
|
+
## Time and history
|
|
513
|
+
|
|
514
|
+
Follow Wikipedia's treatment. The article describes the **current state** —
|
|
515
|
+
present tense, in the lead and body. The lead is a concise current-state summary:
|
|
516
|
+
never scatter "previously …" caveats through it.
|
|
517
|
+
|
|
518
|
+
When the user's position genuinely EVOLVES over time, the trajectory is
|
|
519
|
+
**PRESERVED** in a dedicated **## History** section (we KEEP the history — we do
|
|
520
|
+
NOT delete it). The lead/body resolve to the current state; the History section
|
|
521
|
+
records the change with citations to BOTH the earlier and the later source
|
|
522
|
+
(*"previously <earlier>; as of <date> <later>"*).
|
|
523
|
+
|
|
524
|
+
Classify before editing — keep the evolution of the USER'S POSITIONS, not the
|
|
525
|
+
AI's MISTAKES:
|
|
526
|
+
- **Evolution** (a relationship / opinion / preference / stance the user changed
|
|
527
|
+
across dated statements) → resolve the lead to the current value AND add or
|
|
528
|
+
extend the **## History** section preserving the trajectory.
|
|
529
|
+
- **Factual error** (a world-fact or spec that was simply WRONG, or a flat "no,
|
|
530
|
+
that is wrong, it is actually <value>") → **silently overwrite** with the
|
|
531
|
+
correct value: NO History entry, the wrong value pruned entirely as if it had
|
|
532
|
+
never been there.
|
|
533
|
+
`;
|
|
494
534
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
535
|
+
const BUCKETING = `# Bucketing Policy
|
|
536
|
+
|
|
537
|
+
How a chunk's subjects are routed to articles. This documents the **current
|
|
538
|
+
default behavior** — the pipeline already works this way; edit this page to
|
|
539
|
+
change it.
|
|
540
|
+
|
|
541
|
+
## Defaults
|
|
542
|
+
|
|
543
|
+
- **Strongly prefer existing articles.** A chunk's subject that matches an
|
|
544
|
+
existing article (by canonical name or alias) folds into that article. Only
|
|
545
|
+
mint a NEW subject article when no existing one is a reasonable fit — and even
|
|
546
|
+
then, only when the subject is substantive enough to warrant its own article
|
|
547
|
+
(it recurs in your thinking, or the chunk engages it as a genuine subject),
|
|
548
|
+
not a single fleeting mention.
|
|
549
|
+
- A chunk may belong to **multiple** existing articles when it genuinely spans
|
|
550
|
+
them — it fans out to every subject it is about.
|
|
551
|
+
- If a subject fits one or more existing articles, do not also mint a new article
|
|
552
|
+
for it. **Existing articles win in any tie.**
|
|
553
|
+
- Article names are Wikipedia-style: the specific subject, title-cased (see
|
|
554
|
+
\`Entities.md\`).
|
|
555
|
+
- A subject too thin or fleeting to deserve its own article — and with no
|
|
556
|
+
existing home — is **left captured in its chunk** (still retrievable by
|
|
557
|
+
search), never dropped and never forced into a junk article. It earns an
|
|
558
|
+
article later if it recurs.
|
|
559
|
+
|
|
560
|
+
## How to tune
|
|
561
|
+
|
|
562
|
+
- **More, smaller articles:** lower the bar for minting a new article (split
|
|
563
|
+
readily; treat narrower subjects as article-worthy).
|
|
564
|
+
- **Fewer, larger articles:** raise the bar; prefer folding into an existing
|
|
565
|
+
broad subject over spawning a new one.
|
|
566
|
+
|
|
567
|
+
The router follows this page over its built-in defaults.
|
|
568
|
+
`;
|
|
499
569
|
|
|
500
|
-
|
|
570
|
+
const ARTICLE_CONVENTIONS = `# Article Conventions
|
|
501
571
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
572
|
+
Every article is one Markdown file describing one entity, written to a fixed
|
|
573
|
+
top-to-bottom grammar. The write pipeline emits this shape and the parser reads
|
|
574
|
+
it deterministically — keep the order exactly as below.
|
|
575
|
+
|
|
576
|
+
## Article grammar (fixed, top to bottom)
|
|
577
|
+
|
|
578
|
+
1. **\`# H1\`** — the title, equal to the filename stem with \`_\` → space (the
|
|
579
|
+
file \`<Subject_Name>.md\` has \`# <Subject Name>\`). Exactly one H1.
|
|
580
|
+
2. **Series banner** (optional) — a single italic line directly under the H1:
|
|
581
|
+
\`*Part of a series on [[Series Name]].*\`. Present only when the article belongs
|
|
582
|
+
to a named series.
|
|
583
|
+
3. **Infobox** (optional) — a fenced \`\`\`info\` block of \`key: value\` lines (see
|
|
584
|
+
below). Comes before the lead.
|
|
585
|
+
4. **Lead** — a 2–4 sentence abstract: present tense, names the thing in **bold**
|
|
586
|
+
in the first sentence, says what it is, and characterizes the user's
|
|
587
|
+
relationship to it (uses / owns / chose / considered) — written in the THIRD
|
|
588
|
+
person, not just a spec definition.
|
|
589
|
+
5. **Sections** — \`##\` (and nested \`###\`) sections in natural reading order,
|
|
590
|
+
one sub-topic each.
|
|
591
|
+
6. **\`## See also\`** — bullet list of \`[[wikilinks]]\` to related articles.
|
|
592
|
+
7. **\`## Notes\`** (optional) — \`[^N]\` commentary footnotes.
|
|
593
|
+
8. **\`## References\`** — the \`[^N]:\` definitions. This is ALWAYS the LAST section.
|
|
594
|
+
|
|
595
|
+
## Voice and scope
|
|
596
|
+
|
|
597
|
+
Follow Wikipedia's conventions in every respect EXCEPT two deliberate carve-outs:
|
|
598
|
+
|
|
599
|
+
- **Voice — THIRD PERSON, always.** Write like Wikipedia: never the first person ("I
|
|
600
|
+
use…", "my pick"). Refer to the user in the third person ("the user uses…",
|
|
601
|
+
"the user considers…"). The subject of the article is the topic; the article
|
|
602
|
+
records what the user thinks and does regarding it.
|
|
603
|
+
- **Carve-out 1 — notability.** Wikipedia's notability bar does NOT apply: anything
|
|
604
|
+
the user discussed is notable enough for an article (see \`Entities.md\`).
|
|
605
|
+
- **Carve-out 2 — neutrality.** Wikipedia's neutral-point-of-view does NOT apply:
|
|
606
|
+
these articles document the user's OWN positions and opinions. Capture the user's
|
|
607
|
+
current stance on the topic accurately, including subjective judgments — the goal
|
|
608
|
+
is to record what the user currently thinks. Everything else (structure, citations,
|
|
609
|
+
summary style, third-person voice) is standard Wikipedia.
|
|
610
|
+
|
|
611
|
+
## Citations / footnotes
|
|
612
|
+
|
|
613
|
+
Inline claims carry a \`[^N]\` marker; the \`## References\` section collects the
|
|
614
|
+
matching definitions. Every marker has exactly one definition and vice-versa.
|
|
615
|
+
|
|
616
|
+
The footnote definition format is fixed (the Lucien standard):
|
|
617
|
+
|
|
618
|
+
\`\`\`
|
|
619
|
+
[^N]: \`conv:HASH\` (YYYY-MM-DD, source) — desc
|
|
620
|
+
\`\`\`
|
|
621
|
+
|
|
622
|
+
where **\`HASH\` = the first 8 lowercase hex digits of the conversation UUID with
|
|
623
|
+
hyphens stripped** (e.g. \`00000000-0000-0000-0000-000000000000\` → \`00000000\`).
|
|
624
|
+
The hash identifies the CONVERSATION only — it deliberately carries no chunk
|
|
625
|
+
range — so chunk→section provenance is recovered from structured state, never by
|
|
626
|
+
parsing footnotes. \`desc\` is a short note of what the conversation covered.
|
|
506
627
|
|
|
507
628
|
## Links
|
|
508
629
|
|
|
509
630
|
Use wikilinks for internal references: \`[[Article Name]]\`. These resolve to the
|
|
510
631
|
correct files (spaces vs underscores and case are normalized).
|
|
511
632
|
|
|
633
|
+
## Infobox
|
|
634
|
+
|
|
635
|
+
The infobox is a fenced \`\`\`info\` block placed between the H1/banner and the
|
|
636
|
+
lead. It is fenced so \`parseToc\`/\`extractSection\`/\`searchArticles\` skip it (its
|
|
637
|
+
keys are never headings or searchable prose). Rules:
|
|
638
|
+
|
|
639
|
+
- Keys are \`snake_case\`.
|
|
640
|
+
- A value that names another entity is a \`[[wikilink]]\` (load-bearing for
|
|
641
|
+
NAVIGATION — it feeds the link graph).
|
|
642
|
+
- \`aliases:\` is a **comma**-separated list feeding the entity index.
|
|
643
|
+
- Other multi-value fields are **\`;\`**-separated.
|
|
644
|
+
- A \`kind:\` field tags the closed entity-kind (\`thing\`/\`person\`/\`domain\`/
|
|
645
|
+
\`project\`/\`standard\`, default \`thing\`); a \`type:\` field carries the emergent
|
|
646
|
+
label (a short free-form noun phrase). See \`Infobox_Schemas.md\`.
|
|
647
|
+
|
|
648
|
+
Every field is either a **world-fact** (spec-sheet / citable) or a
|
|
649
|
+
**relationship-fact** (conversation-established — the personal layer). Both are
|
|
650
|
+
CONTENT the AI reads; there is no numeric facet or \`gte/lte\` query over any field.
|
|
651
|
+
|
|
652
|
+
### Field-kind taxonomy
|
|
653
|
+
|
|
654
|
+
The table below teaches the value SHAPE per field-kind only — every \`field\` cell
|
|
655
|
+
is a \`<…>\` placeholder and every \`example\` cell is schematic. NEVER copy a key
|
|
656
|
+
or a value from here into an article; every key and value must come from the
|
|
657
|
+
chunk text about the actual entity. The fixed keys (\`type\`, \`kind\`, \`owned\`,
|
|
658
|
+
\`acquired\`, \`used_for\`, \`chosen_over\`, \`status\`, \`opinion\`, \`aliases\`) are the
|
|
659
|
+
domain-neutral vocabulary to draw from when the chunks support them; every
|
|
660
|
+
domain-specific key is supplied by the chunk, never by this page.
|
|
661
|
+
|
|
662
|
+
| field | kind | value-type | example (schematic) |
|
|
663
|
+
| --- | --- | --- | --- |
|
|
664
|
+
| \`type\` | world | enum | \`<entity type>\` |
|
|
665
|
+
| \`kind\` | world | enum | one of thing\\|person\\|domain\\|project\\|standard |
|
|
666
|
+
| \`<world_entity_key>\` | world | entity-link | \`[[Linked Entity]]\` |
|
|
667
|
+
| \`<world_scalar_key>\` | world | scalar | \`<value>\` |
|
|
668
|
+
| \`<world_enum_key>\` | world | enum | \`<value>\` |
|
|
669
|
+
| \`<world_list_key>\` | world | list | \`[[Entity A]]; [[Entity B]]\` |
|
|
670
|
+
| \`owned\` | relationship | enum | \`yes\` (\`yes\`\\|\`no\`\\|\`wishlist\`) |
|
|
671
|
+
| \`acquired\` | relationship | date | \`<YYYY-MM + how>\` |
|
|
672
|
+
| \`used_for\` | relationship | list | \`<use>; <use>\` |
|
|
673
|
+
| \`chosen_over\` | relationship | entity-link | \`[[Linked Entity]]\` |
|
|
674
|
+
| \`status\` | relationship | scalar | \`<short status>\` |
|
|
675
|
+
| \`opinion\` | relationship | scalar | \`<your one-line take>\` |
|
|
676
|
+
|
|
677
|
+
\`owned\`'s \`wishlist\` value means wants-but-doesn't-yet-own. Each world-fact is
|
|
678
|
+
spec-sheet verifiable; each relationship-fact is established in conversation.
|
|
679
|
+
Apply a field only when the chunk supports it — a world-fact spec key belongs on
|
|
680
|
+
the kind of entity it describes (typically a hardware \`thing\`), never on a
|
|
681
|
+
\`domain\` or \`standard\`.
|
|
682
|
+
|
|
683
|
+
### Example info block (ILLUSTRATIVE SCHEMA — never copy these values)
|
|
684
|
+
|
|
685
|
+
The block below is a SHAPE, not content: every \`<…>\` is a placeholder. NEVER
|
|
686
|
+
copy these keys or values into a real article — emit ONLY facts the article's own
|
|
687
|
+
source chunks establish, and OMIT any key the chunks do not support. A key that
|
|
688
|
+
does not apply to the entity (e.g. a world-fact spec key on a \`domain\`, \`person\`,
|
|
689
|
+
or \`standard\`) must not appear at all.
|
|
690
|
+
|
|
691
|
+
\`\`\`info
|
|
692
|
+
type: <emergent label, from the chunks>
|
|
693
|
+
kind: <thing | person | domain | project | standard>
|
|
694
|
+
<world_fact_key>: <world value, from the chunks>
|
|
695
|
+
<relationship_fact_key>: <relationship value, from the chunks>
|
|
696
|
+
aliases: <comma-separated surface variants>
|
|
697
|
+
\`\`\`
|
|
698
|
+
|
|
699
|
+
## Categories
|
|
700
|
+
|
|
701
|
+
An article declares its category memberships with a single line near the top:
|
|
702
|
+
|
|
703
|
+
\`\`\`
|
|
704
|
+
categories: [[Category:<Name>]], [[Category:<Name>]]
|
|
705
|
+
\`\`\`
|
|
706
|
+
|
|
707
|
+
Categories are emergent and explicit — declared per-article by judgment, never
|
|
708
|
+
derived from the infobox \`type\`. See \`Category_Definitions.md\`.
|
|
709
|
+
|
|
512
710
|
## Stubs
|
|
513
711
|
|
|
514
|
-
New or thin articles may be marked \`{{stub}}\` at the top.
|
|
515
|
-
|
|
712
|
+
New or thin articles may be marked \`{{stub}}\` at the top. An article is a stub
|
|
713
|
+
when it has fewer than 2 body sections OR fewer than 40 words of body prose
|
|
714
|
+
(excluding the infobox and References). Stubs are legitimate — depth comes
|
|
715
|
+
through accumulation. See \`Summary_Style.md\` for split/merge rules.
|
|
516
716
|
`;
|
|
517
717
|
|
|
518
718
|
const BUCKETS = `# Buckets
|
|
519
719
|
|
|
720
|
+
> **Superseded by \`Entities.md\` for synthesis targeting; retained as optional
|
|
721
|
+
> staging.** Synthesis now routes chunks to entity articles (see \`Entities.md\`),
|
|
722
|
+
> not buckets. Buckets survive only as an optional staging layer.
|
|
723
|
+
|
|
520
724
|
The bucket taxonomy used to organize segments of conversation into articles.
|
|
521
725
|
Buckets are emergent — derived from the actual content of conversations, not
|
|
522
726
|
imposed in advance. Populated by synthesis runs.
|
|
@@ -524,20 +728,243 @@ imposed in advance. Populated by synthesis runs.
|
|
|
524
728
|
|
|
525
729
|
const TOPICS_TO_IGNORE = `# Topics to Ignore
|
|
526
730
|
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
731
|
+
The chunker consults this page (mandatorily) before emitting chunks.
|
|
732
|
+
|
|
733
|
+
**Current policy: nothing is ignored. Surface everything.** Emit chunks for all substantive content; do not omit any span on the basis of this page. There are no excluded topics, people, or content categories.
|
|
734
|
+
|
|
735
|
+
To change this later: add plain-text descriptions of topics/people/content that should not be synthesized into the Dreaming, one per line under a list below. Semantic matching catches related content even when phrasing differs. While this section says "nothing is ignored," ignore nothing.
|
|
736
|
+
`;
|
|
737
|
+
|
|
738
|
+
const INFOBOX_SCHEMAS = `# Infobox Schemas
|
|
739
|
+
|
|
740
|
+
Infobox schemas are **emergent**, not a closed type list. This page is the
|
|
741
|
+
editable policy: a fixed generic grammar plus a growing registry of per-\`type\`
|
|
742
|
+
field sets the model has actually used. There is NO code-level enum of infobox
|
|
743
|
+
\`type\`s and NO \`type→schema\` map — editing this page re-tunes infobox extraction
|
|
744
|
+
with no code change.
|
|
745
|
+
|
|
746
|
+
## The grammar (the only fixed part)
|
|
747
|
+
|
|
748
|
+
1. **Every fact is one of two kinds:**
|
|
749
|
+
- a **world-fact** — spec-sheet / citable (a \`<world_fact_key>\`);
|
|
750
|
+
- a **relationship-fact** — conversation-established, the personal-notability
|
|
751
|
+
layer (\`owned\`, \`used_for\`, \`chosen_over\`, and the like).
|
|
752
|
+
Both are CONTENT the AI reads; neither is a query/filter index.
|
|
753
|
+
2. **Keys are \`snake_case\`.**
|
|
754
|
+
3. **A value naming another entity is a \`[[wikilink]]\`** — this feeds the link
|
|
755
|
+
graph for navigation.
|
|
756
|
+
4. **Value-types are \`scalar | entity-link | enum | list | date\`.**
|
|
757
|
+
5. **\`kind:\`** tags the closed entity-kind (\`thing\`/\`person\`/\`domain\`/
|
|
758
|
+
\`project\`/\`standard\`, default \`thing\`); **\`type:\`** carries the emergent label
|
|
759
|
+
(a short free-form label).
|
|
760
|
+
|
|
761
|
+
When a newly-emergent \`type\` has no registry entry, propose one (a world /
|
|
762
|
+
relationship field split) and append it below. Reconcile a new \`type\` exactly as
|
|
763
|
+
a new category name is added to \`Category_Definitions.md\`.
|
|
764
|
+
|
|
765
|
+
## Registry (grows by judgment)
|
|
766
|
+
|
|
767
|
+
Each entry below is an **illustrative seed, not a closed set — extend by judgment
|
|
768
|
+
when a new kind of thing appears.** Field NAMES are a vocabulary to draw from
|
|
769
|
+
WHEN the chunks support them; any example VALUE anywhere in Meta is illustrative
|
|
770
|
+
ONLY. **NEVER copy a key or value (a \`type\`, a \`<world_fact_key>\`) into an article
|
|
771
|
+
whose own chunks do not establish it**, and never attach a world-fact spec to a
|
|
772
|
+
\`domain\` / \`person\` / \`standard\` entity.
|
|
773
|
+
|
|
774
|
+
### <type>
|
|
775
|
+
*Illustrative SHAPE of a registry entry, not real content — every \`<…>\` is a
|
|
776
|
+
placeholder; the real keys are supplied by the entity's own chunks. Extend by
|
|
777
|
+
judgment.*
|
|
778
|
+
- **world:** \`type\`, \`<world_fact_key>\`, \`<world_fact_key>\`
|
|
779
|
+
- **relationship:** \`owned\`, \`acquired\`, \`used_for\`, \`chosen_over\`, \`opinion\`, \`status\`
|
|
780
|
+
|
|
781
|
+
The fixed relationship keys above are the domain-neutral personal layer; each
|
|
782
|
+
\`<world_fact_key>\` slot is filled per-\`type\` from the chunks, NOT from this page.
|
|
783
|
+
`;
|
|
784
|
+
|
|
785
|
+
const CATEGORY_DEFINITIONS = `# Category Definitions
|
|
786
|
+
|
|
787
|
+
Categories are **emergent**, derived from your actual content — never imposed in
|
|
788
|
+
advance. There is NO hardcoded category vocabulary and NO \`type→category\` map.
|
|
789
|
+
This page is the editable policy plus a growing registry; editing it re-tunes
|
|
790
|
+
categorization with no code change.
|
|
791
|
+
|
|
792
|
+
## What a category is
|
|
793
|
+
|
|
794
|
+
A category is a **Wikipedia-style grouping of things** — a named set an article
|
|
795
|
+
joins by declaring membership. An article declares its categories with a single
|
|
796
|
+
line near the top:
|
|
797
|
+
|
|
798
|
+
\`\`\`
|
|
799
|
+
categories: [[Category:<Name>]], [[Category:<Name>]]
|
|
800
|
+
\`\`\`
|
|
801
|
+
|
|
802
|
+
Categories come into existence the first time an article declares them. A fresh
|
|
803
|
+
wiki starts with **zero** categories and grows them as articles are written.
|
|
804
|
+
|
|
805
|
+
## Naming rules
|
|
806
|
+
|
|
807
|
+
- **Title-case plural noun** (a \`<Plural Noun>\` naming the shared grouping).
|
|
808
|
+
- **Specific**, not vague (a precise grouping name, never a catch-all like \`Things\`).
|
|
809
|
+
- **Create a new category only when ≥2 articles would genuinely share it**;
|
|
810
|
+
otherwise reuse an existing one or omit it. **Existing categories win** —
|
|
811
|
+
prefer an established name over a near-duplicate new one.
|
|
812
|
+
|
|
813
|
+
## Registry
|
|
814
|
+
|
|
815
|
+
One \`Name — definition — parent?\` line is added here as each category is first
|
|
816
|
+
created. (Empty until the first category is declared.)
|
|
817
|
+
`;
|
|
818
|
+
|
|
819
|
+
const ENTITIES_POLICY = `# Entities
|
|
820
|
+
|
|
821
|
+
Governs ENTITY-EXTRACT and ROUTE: which things become entity articles, and how
|
|
822
|
+
they are named. Inlined into the stage prompts.
|
|
823
|
+
|
|
824
|
+
## The five kinds
|
|
825
|
+
|
|
826
|
+
Every entity has exactly one \`kind\` from the closed set:
|
|
827
|
+
|
|
828
|
+
- **thing** — a concrete object, product, or artifact (a named object).
|
|
829
|
+
- **person** — a named individual.
|
|
830
|
+
- **domain** — a broad subject area or field (a named field or area of study).
|
|
831
|
+
- **project** — an ongoing effort with a goal.
|
|
832
|
+
- **standard** — a spec, format, protocol, or material (a named spec or material).
|
|
833
|
+
|
|
834
|
+
Default to \`thing\` when no other kind clearly applies.
|
|
835
|
+
|
|
836
|
+
## Which subjects earn an article
|
|
837
|
+
|
|
838
|
+
This page does NOT gate on ownership, usefulness, or any single hard count.
|
|
839
|
+
Notability is editorial: **anything that recurs in your thinking is notable
|
|
840
|
+
enough**, and stub articles are encouraged for emerging topics (see
|
|
841
|
+
\`Editorial_Guidelines.md\`). Routing strongly prefers an existing article and
|
|
842
|
+
mints a new one only for a substantive, recurring subject with no existing home
|
|
843
|
+
(see \`Bucketing.md\`). **Nothing is dropped as trivia** — a subject with no
|
|
844
|
+
article yet is captured in its chunk and stays retrievable by search.
|
|
845
|
+
|
|
846
|
+
## Canonical naming
|
|
847
|
+
|
|
848
|
+
- Use **Wikipedia title casing**.
|
|
849
|
+
- Prefer the **specific subject name** (the actual named subject from the chunk,
|
|
850
|
+
not a generic descriptor like "the thing" or "that one").
|
|
851
|
+
- \`aliases\` capture the variants (spelling, spacing, and short-form variants of
|
|
852
|
+
the same name) so they all resolve to one article.
|
|
853
|
+
|
|
854
|
+
## Emit both granularities
|
|
855
|
+
|
|
856
|
+
When a chunk is about a specific thing inside a broad area, emit **both** the
|
|
857
|
+
specific entity AND the broad domain it belongs to — the precise product/proper
|
|
858
|
+
name and its connective field — so both the precise and the connective article
|
|
859
|
+
get the chunk. Do NOT copy example names from this policy; only emit things that
|
|
860
|
+
actually appear in the chunk text.
|
|
861
|
+
|
|
862
|
+
## Always keep the most specific name
|
|
863
|
+
|
|
864
|
+
ALWAYS emit the **most specific proper noun present in the chunk text** (the named
|
|
865
|
+
product, tool, person, place, or model). Never drop the concrete named thing in
|
|
866
|
+
favor of only the broad domain — the specific name is the load-bearing entity.
|
|
867
|
+
`;
|
|
868
|
+
|
|
869
|
+
const SUMMARY_STYLE = `# Summary Style
|
|
870
|
+
|
|
871
|
+
How articles split, merge, and mark stubs — Wikipedia's summary-style rules,
|
|
872
|
+
adapted. NORMALIZE and the parser recognize the template syntax defined here.
|
|
873
|
+
|
|
874
|
+
## SPLIT
|
|
875
|
+
|
|
876
|
+
When a thing covered inside a section **crosses the notability checklist** AND is
|
|
877
|
+
**large enough** (≥ a screen of prose, or worth its own infobox), move it to its
|
|
878
|
+
own article \`Specific_Thing.md\`. In the parent, leave a **2–3 sentence summary**
|
|
879
|
+
followed by a main-article pointer:
|
|
880
|
+
|
|
881
|
+
\`\`\`
|
|
882
|
+
*Main article: [[Specific_Thing]]*
|
|
883
|
+
\`\`\`
|
|
884
|
+
|
|
885
|
+
Every \`[^N]\` citation in the moved text travels with it to the child — no facts
|
|
886
|
+
are lost.
|
|
887
|
+
|
|
888
|
+
## MERGE
|
|
889
|
+
|
|
890
|
+
When two stubs describe the **same thing under different names**, merge them into
|
|
891
|
+
the canonical title. The loser's name becomes an \`alias\` on the survivor, and a
|
|
892
|
+
redirect note records the merge.
|
|
893
|
+
|
|
894
|
+
## Template syntax
|
|
895
|
+
|
|
896
|
+
- **\`{{Main}}\`** — the main-article pointer, written \`*Main article: [[Target]]*\`.
|
|
897
|
+
- **\`{{stub}}\`** — placed at the top of a thin article.
|
|
898
|
+
- **redirect** — a one-line note on a merged-away title pointing at the canonical
|
|
899
|
+
article (\`*Redirects to [[Canonical]].*\`).
|
|
900
|
+
|
|
901
|
+
## Stub threshold (baked)
|
|
902
|
+
|
|
903
|
+
An article is a **stub** when it has **fewer than 2 body sections OR fewer than
|
|
904
|
+
40 words of body prose** (excluding the infobox and the References section).
|
|
905
|
+
|
|
906
|
+
## Worked example (SCHEMATIC — \`<…>\` placeholders only, never copy these literally)
|
|
907
|
+
|
|
908
|
+
A \`<Parent Subject>\` article has a \`<Child Subject>\` subsection that has grown to
|
|
909
|
+
own an infobox-worth of owned/used facts — it crosses notability and size, so it
|
|
910
|
+
SPLITS.
|
|
911
|
+
|
|
912
|
+
**Parent, after the split** (\`<Parent_Subject>\`, the \`<Child Subject>\` subsection):
|
|
913
|
+
|
|
914
|
+
\`\`\`
|
|
915
|
+
### <Child Subject>
|
|
916
|
+
|
|
917
|
+
<A 2–3 sentence summary of the child subject and how the user relates to it,
|
|
918
|
+
carrying any citation marker(s) from the moved prose.>[^k]
|
|
919
|
+
|
|
920
|
+
*Main article: [[<Child Subject>]]*
|
|
921
|
+
\`\`\`
|
|
922
|
+
|
|
923
|
+
**New child** (\`<Child_Subject>.md\`), with its own infobox and the facts moved
|
|
924
|
+
from the parent:
|
|
925
|
+
|
|
926
|
+
- \`# <Child Subject>\`
|
|
927
|
+
- an \`info\` block: \`type: <emergent label>\`, \`<world_fact_key>: [[Linked Entity]]\`,
|
|
928
|
+
\`<world_fact_key>: <value>\`, \`kind: thing\`, \`owned: <yes|no|wishlist>\`,
|
|
929
|
+
\`acquired: <YYYY-MM + how>\`,
|
|
930
|
+
\`used_for: <use>; <use>\`,
|
|
931
|
+
\`aliases: <surface variant>, <surface variant>\`
|
|
932
|
+
- a lead naming the **<Child Subject>** in bold, then \`## See also\` →
|
|
933
|
+
\`[[Linked Entity]]\`, then \`## References\` last.
|
|
934
|
+
|
|
935
|
+
Every \`[^N]\` from the parent subsection (here \`[^k]\`) travels to the child — the
|
|
936
|
+
\`[^k]: \`conv:HASH\` (…)\` definition moves with the prose so no citation is lost.
|
|
937
|
+
`;
|
|
938
|
+
|
|
939
|
+
const CHUNKING = `# Chunking Style
|
|
940
|
+
|
|
941
|
+
How the conversation-segmentation stage decides what a chunk is. This documents the **current default behavior** — the pipeline already works this way; edit this page to change it. (The mechanism — every conversation is segmented into topic chunks emitted in the fixed output schema — is not tunable here; only the style below is.)
|
|
942
|
+
|
|
943
|
+
## Defaults
|
|
944
|
+
|
|
945
|
+
- Most substantive conversations contain **multiple** chunks, not one. Look hard for topic shifts.
|
|
946
|
+
- A topic shift is when the discussion moves from one subject to a **substantially different** subject (e.g. one feature → a different feature; a problem → a distinct related concern; topic X → topic Y).
|
|
947
|
+
- Sub-chunks for specific aspects within a single broad topic are acceptable.
|
|
948
|
+
- A short conversation (under ~4 messages, a single Q&A) may legitimately be one chunk. Most longer conversations are multiple.
|
|
949
|
+
- A topic that recurs later in the same conversation is its **own separate chunk**, not merged with the earlier occurrence.
|
|
950
|
+
- **Overlap:** two chunks may share **at most one boundary message**, and only when that message is genuinely substantive to *both* the topic ending and the one beginning (true dual-membership). Never overlap for connective filler ("anyway, switching gears"), and never let one chunk's range envelop several messages of another's — if two chunks would overlap by more than one message, redraw the boundary instead.
|
|
951
|
+
- Labels are specific and descriptive, ~4–10 words: name the concrete subject and the facet discussed (\`<specific subject> <facet>\`), never a vague catch-all (\`<generic topic word>\` alone, "a technical discussion", "a Q&A").
|
|
531
952
|
|
|
532
|
-
##
|
|
953
|
+
## How to tune
|
|
533
954
|
|
|
534
|
-
-
|
|
955
|
+
To bias toward fewer, larger chunks: instruct fewer/coarser boundaries and discourage aspect sub-chunks. To bias toward more, smaller chunks: encourage finer aspect splits. To change overlap behavior: state how aggressively boundary messages should be shared. The chunker follows this page over its built-in defaults.
|
|
535
956
|
`;
|
|
536
957
|
|
|
537
|
-
const META_PAGES: Record<string, string> = {
|
|
958
|
+
export const META_PAGES: Record<string, string> = {
|
|
538
959
|
"Editorial_Guidelines.md": EDITORIAL_GUIDELINES,
|
|
960
|
+
"Bucketing.md": BUCKETING,
|
|
539
961
|
"Article_Conventions.md": ARTICLE_CONVENTIONS,
|
|
962
|
+
"Infobox_Schemas.md": INFOBOX_SCHEMAS,
|
|
963
|
+
"Category_Definitions.md": CATEGORY_DEFINITIONS,
|
|
964
|
+
"Entities.md": ENTITIES_POLICY,
|
|
965
|
+
"Summary_Style.md": SUMMARY_STYLE,
|
|
540
966
|
"Buckets.md": BUCKETS,
|
|
967
|
+
"Chunking.md": CHUNKING,
|
|
541
968
|
"Topics_to_Ignore.md": TOPICS_TO_IGNORE,
|
|
542
969
|
};
|
|
543
970
|
|