KNOWX · 00
Audience: Developers implementing the first-party KnowX agent — vocabulary, services, and pipeline.
Twin: Builders version
Scenario: Fresh sandbox* · install opx then knowx · agentIds: ["knowx"] (inherits opx).
Packages: @x12i/memorix-knowx-pack, @x12i/memorix-opx-pack, @x12i/memorix-service, @x12i/memorix-pipeline, @x12i/memorix-format, @x12i/memorix-relationships.
Prerequisites: Agent packs · Services · Pipelines · Format.
Site: https://docs.memorix.x12i.com · Hard rules
Status: Present-tense tutorial for the shipped @x12i/memorix-knowx-pack. Deterministic fixture stubs — no live AI required. Replace stubs with real service bodies using the Memorix contracts in §B.
KNOWX · 00
Work in authoring order: A vocabulary → B services → C pipeline → D install & run.
knowx) plus a first-party agent pack — not a siloed graph engine.knowx is a child of opx. Scope with agentIds: ["knowx"] so inheritance collapses opx + knowx.knowx-ingest-associate persists via write-record and relationship-write.epistemic.state ≠ extraction confidence.associated*, no abstract collections.Labels: Stored subject content · Virtual abstract projection · Operational run ledgers.
KNOWX · 00
text + knowledgeSource
→ knowx-extract (drafts only)
→ write-record knowx (knowledge added)
→ knowx-associate-knowledge
→ relationship-write (known / supports / contradicts / derived-from)
→ knowx-associate-entities
→ relationship-write (edge-from / edge-to)
Folder / content-source path:
managed folder source
→ knowx-reconcile-folder (enumerate → extract Markdown → commitPage content/raw)
→ knowx-extract (content → knowxDrafts + lineage)
→ write-record knowx
→ associate + relationship-write
Sources contain items. Extractors turn source items into canonical content. KnowX derives Knowledge from content.
flowchart LR
Text[text plus knowledge source] --> Extract[knowx-extract]
Extract --> Write[write-record knowx]
Write --> AssocK[knowx-associate-knowledge]
AssocK --> RelK[relationship-write knowledge links]
RelK --> AssocE[knowx-associate-entities]
AssocE --> RelE[relationship-write entity links]
KNOWX · 00
memorix-format registers knowx and confirmations. Payload rules:
| Layer | Name | Stored? |
|---|---|---|
| Content type | knowx |
Yes |
| Discriminator | data.kind: NODE | EDGE |
Inside .data |
| Abstract | KnowXEntity |
Virtual only — NODE/EDGE + relationship navigation properties |
| Abstract | KnowXContent |
Virtual — canonical Markdown documents (content OT) |
| Abstract | KnowXMaterials |
Virtual — REST fixture materials |
| Forbidden | KnowXNode / KnowXEdge types or collections |
— |
Package: @x12i/memorix-knowx-pack
metadata/
agents/knowx.json # parentAgentId: opx
abstract-types.json # KnowXEntity (+ People/WorkItems restated for standalone validate)
abstract-bindings.json # knowx-entity-union
object-types.json # employees/contractors/work-items overlays + assertions
relationship-definitions.json
services.json
pipelines-and-sources.json
fixtures/knowx-activity-log.jsonl
src/knowx-services.ts # deterministic stubs
Known pack id: knowx → memorix-metadata/examples/knowx/normalized/pack.json (explicit install only).
| OT | Role |
|---|---|
employees / contractors / work-items |
Host OTs — knowx pack replaces opx defs to add CT knowx + KnowXEntity |
assertions |
Claim subjects — CTs knowx (required), workflow, confirmations, relationships |
materials |
Fixture Memory pull intake — abstract KnowXMaterials |
content |
Canonical ingested Markdown + provenance — abstract KnowXContent; landed as raw |
NODE facets share the host recordId. EDGE claims get their own recordId on assertions.
| Id | Classification / use |
|---|---|
knowx-same-as |
known — matches existing claim |
knowx-supports |
Reinforces existing |
knowx-contradicts |
contradicts existing |
knowx-derived-from |
Derived from another claim |
knowx-edge-from |
EDGE → domain from-endpoint |
knowx-edge-to |
EDGE → domain to-endpoint |
knowx-derived-from-content |
KnowXEntity → KnowXContent lineage |
Domain assignment links may still use opx people-assigned-to-work-items after human accept (operator flow).
Sources are adapters — not extractors. Package path: memorix-knowx-pack/src/sources/adapter.ts.
interface ContentSourceAdapter<TConfig = unknown> {
readonly kind: string;
validate(config, context: SourceContext): Promise<SourceValidation>;
enumerate(config, context: EnumerateContext): AsyncIterable<DiscoveredSourceItem>;
open(item, config, context: OpenContext): Promise<ReadableContent>;
describeOrigin(item, config, context): ContentOrigin;
watch?(config, onEvent, context: WatchContext): Promise<WatchHandle>;
}
Rules:
relativePath, extension, streams).ReadableContent / canonical content only.FolderContentSourceAdapter (kind: "folder") — recursive walk, symlink-safe containment, optional fs.watch.Separate from knowx-extract (Knowledge drafts). Registry: createKnowxExtractorRegistry().
| Format | Id | Notes |
|---|---|---|
| Markdown | knowx-markdown |
Front-matter title; empty → INTENTIONALLY_EMPTY |
| HTML | knowx-html |
Strips script/style/nav; no remote fetch |
knowx-pdf |
Encrypted → DOCUMENT_ENCRYPTED; image-only → NO_EXTRACTABLE_TEXT (no OCR) |
|
| DOCX / PPTX / XLSX | knowx-docx / knowx-pptx / knowx-xlsx |
Probe by magic + ext; XLSX truncates large sheets |
Contract: probe → highest-confidence match → extract → ExtractionSuccess | ExtractionFailure. Canonical landed shape: ContentRecordData (markdown, contentHash, origins, extraction, revision, knowledgeStatus) on object type content.
Control plane (memorix-knowx-control-plane, /api/knowx/v1/folder-sources, default port KNOWX_PORT / 5110):
| Method | Path |
|---|---|
POST / GET |
/api/knowx/v1/folder-sources |
GET / PATCH / DELETE |
/api/knowx/v1/folder-sources/:sourceId |
POST |
.../validate, .../pause, .../resume, .../runs, .../files/ingest |
GET |
.../items, .../runs (+ cancel/retry/resume proxies) |
incremental (default) vs sync (deactivate missing origins after complete reconciliation){ every, unit } — KnowX ticker; not Memory pull), watch (acceleration only; reconcile is authoritative)commitPage with objectType=content, checkpoint.method=fullScanHash, workRef=incremental|synckind: "knowx-folder") so Memorix effective sources include that sourceId — Studio Memory Pulls / checkpoints then resolve the folder source like any other Memory sourceKNOWX_DATA_DIR; Memorix owns checkpoint revision/fingerprints@x12i/memorix-sdk; discovery notes in pack DISCOVERY-GATE.mdEnv: KNOWX_ALLOWED_ROOTS (required allowlist), KNOWX_MOUNTS_JSON, KNOWX_DATA_DIR, KNOWX_PORT, MEMORIX_URL, MEMORIX_ORG_ID.
type SourceSpan =
| { jsonPath: string }
| { lineStart: number; lineEnd: number }
| { byteStart: number; byteEnd: number };
type KnowxProvenance = {
sourceClass: "measured" | "inferred" | "asserted" | "imported";
sources: Array<{
docId: string;
docType: string;
docHash: string; // sha-256 of exact source bytes
span: SourceSpan;
retrievedAt: string;
}>;
extraction: {
method: string;
extractorId: string;
confidence: number; // ≠ epistemic.state
};
};
Missing provenance ⇒ reject writes / fail the extract step.
KNOWX · 00
These are the Memorix-facing contracts. Implement real bodies against them; fixture stubs in @x12i/memorix-knowx-pack satisfy acceptance without live AI.
Shared rules for all three
analyze (pipeline stepKind: "analyze").kind: "worker" + operation matching the service id.associated*.orgId + agentIds (use ["knowx"]).knowx-extract| Role | Turn text + knowledge source into KnowX drafts (NODE/EDGE), not yet classified. |
| serviceId | knowx-extract |
| operation | knowx-extract |
| Inputs | Legacy: text + knowledgeSource. Content path: contentId / contentIds / reconcileSummary.landedContentIds — load objectType:"content" via SDK Memory, then draft from Markdown |
| Output | knowxDrafts: KnowxDraft[] plus docHash of exact source bytes |
| Draft shape | { objectType, contentType: "knowx", recordId, data } with data.kind, provenance, epistemic; EDGE also has data.refs.{from,to,predicate} |
| Lineage | Content path sets data.provenance.lineage.{sourceContentId,sourceContentRevision,sourceContentHash} and knowx-derived-from-content |
| Errors | MISSING_SOURCE, INVALID_SOURCE_BYTES, MISSING_PROVENANCE |
| Handoff | Pipeline step write-knowx (write-record, contentType: "knowx") consumes knowxDrafts |
| Fixture stub | extractKnowxFromActivityLog — parses fixtures/knowx-activity-log.jsonl → employee NODE, work-item NODE, ASSERTION-99 EDGE |
knowx-associate-knowledge| Role | Classify drafts against existing KnowX scope: known, novel, contradicts; emit knowledge relationship plans. |
| serviceId | knowx-associate-knowledge |
| operation | knowx-associate-knowledge |
| Inputs | drafts — from extract (or already written knowx); existingKnowx — optional pushed catalog. Prefer Explore via injected memorix callback (memorixAccess: ["explore"]) using @x12i/memorix-sdk/client fromInvokeContext (or SDK /worker context.memorix). Explore lists knowx on assertions, employees, contractors, and work-items (not assertions-only) |
| Output | classification: { known[], novel[], contradicts[] }; relationshipPlans[] |
| Plan item | { definitionId, from: { objectType, recordId }, to: { objectType, recordId }, reason? } where definitionId ∈ knowx-same-as | knowx-supports | knowx-contradicts | knowx-derived-from |
| Errors | MISSING_DRAFTS, INVALID_CLASSIFICATION |
| Handoff | Step write-knowledge-links (relationship-write) consumes relationshipPlans |
| Fixture stub | Same objectType+recordId → known + knowx-same-as; EDGE same endpoints different predicate → contradicts + knowx-contradicts; else novel |
knowx-associate-entities| Role | Associate novel KnowX (especially EDGE) to existing domain entities. |
| serviceId | knowx-associate-entities |
| operation | knowx-associate-entities |
| Inputs | novelDrafts — from classification.novel (resolve full drafts); entityCatalog — available entity endpoints / abstracts |
| Output | entityRelationshipPlans[] with definitionId ∈ knowx-edge-from | knowx-edge-to (optional domain defs) |
| Errors | MISSING_NOVEL, UNRESOLVED_ENDPOINT |
| Handoff | Step write-entity-links (relationship-write) consumes entityRelationshipPlans |
| Fixture stub | For each novel EDGE, emit plans from data.refs.from / data.refs.to |
serviceId / operation / output field names.analyze services).KNOWX · 00
| Step id | kind | Binding |
|---|---|---|
extract |
analyze |
serviceId: knowx-extract |
write-knowx |
write-record |
contentType: knowx |
associate-knowledge |
analyze |
serviceId: knowx-associate-knowledge |
write-knowledge-links |
relationship-write |
plans → knowledge defs |
associate-entities |
analyze |
serviceId: knowx-associate-entities |
write-entity-links |
relationship-write |
plans → edge-from/to |
Optional later (operator-driven): workflow + confirmations before treating epistemic as fact; materialize domain links such as people-assigned-to-work-items.
Run evidence lives in the pipeline operational ledger — not in subject content.
knowx-ingest-content-sourceFolder / content path (after control-plane reconcile lands content):
| Step id | kind | Binding |
|---|---|---|
reconcile |
analyze |
serviceId: knowx-reconcile-folder |
extract |
analyze |
serviceId: knowx-extract (contentIds / landedContentIds) |
write-knowx |
write-record |
contentType: knowx |
associate-knowledge |
analyze |
serviceId: knowx-associate-knowledge |
write-knowledge-links |
relationship-write |
includes knowx-derived-from-content |
associate-entities |
analyze |
serviceId: knowx-associate-entities |
write-entity-links |
relationship-write |
edge-from / edge-to |
Control plane prefers mx.pipelines.start("knowx-ingest-content-source", { sourceId, … }); on failure may fall back to local reconcileFolderSource.
KNOWX · 00
# 1) Install parent opx, then knowx (never auto-install)
POST /api/metadata/install { "packId": "opx", "confirm": true }
POST /api/metadata/install { "packId": "knowx", "confirm": true }
# 2) Scope — child agent collapses opx inheritance
X-Memorix-Org-Id: sandbox…
X-Memorix-Agent-Ids: knowx
# 3) Start pipeline with text + knowledge source inputs
POST /api/pipelines/start
{ "pipelineId": "knowx-ingest-associate", … }
Isolation: fresh sandbox* org; beginIsolationSession({ agentIds: ["knowx"] }) when running KnowX acceptance. Default isolation remains ["opx"].
Package tests: cd memorix-knowx-pack && npm test.
src/folder-sources.test.ts patterns:
mkdtemp(…/knowx-folder-) + afterEach rm; set allowedRoots: [tmp].extractKnowxFromContent writes provenance.lineage.*.fullScanHash.KNOWX · 00
On assertion recordId:
knowx — claim + provenance + epistemic workflow — review assignment (PUT /api/workflow) confirmations — accept/rejectAccepted EDGE → optional domain relationship materialize (Explore / relationship APIs). Heavy JSON stays on the claim; links are navigation only.
KNOWX · 00
knowx with parentAgentId: "opx"KnowXEntity union + assertions OT + knowx CT on host OTsknowx-ingest-associate wired end-to-endknowx-ingest-content-source + control plane allowlistpackId: "knowx" installable after opxassociated*, no abstract collections, provenance on every draft