lt.knowledge
lt.knowledge reads and writes the knowledge store: domain-scoped key/value entries kept as Postgres JSONB. Each entry keeps a version history of immutable editions, and escalations reference entries as lookups. See Lookups.
listDomains
Section titled “listDomains”const result = await lt.knowledge.listDomains();List every knowledge domain with its entry count.
Parameters: none.
Returns: LTApiResult<{ domains: Array<{ domain, count, latest }> }>
listEntries
Section titled “listEntries”const result = await lt.knowledge.listEntries({ domain: 'catalog', search: 'materials', tags: ['inventory'], limit: 50, offset: 0,});List the entries in a domain.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string |
Yes | Domain to query |
search |
string |
No | Partial match on key name or tag |
tags |
string[] |
No | Filter by tag overlap |
limit |
number |
No | Max results (default 50, max 200) |
offset |
number |
No | Pagination offset |
Returns: LTApiResult<{ entries: KnowledgeEntry[], total: number }>
getEntry
Section titled “getEntry”const result = await lt.knowledge.getEntry({ domain: 'catalog', key: 'materials' });Get one entry by domain and key.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string |
Yes | Domain |
key |
string |
Yes | Entry key |
Returns: LTApiResult<KnowledgeEntry>, or { found: false } when the entry does not exist.
getEntryVersion
Section titled “getEntryVersion”const result = await lt.knowledge.getEntryVersion({ domain: 'catalog', key: 'materials', version: 2,});Get one immutable edition from an entry’s version history.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string |
Yes | Domain |
key |
string |
Yes | Entry key |
version |
number |
Yes | Edition number |
Returns: LTApiResult<{ domain, key, version, data, tags, created_at }>. 404 when the edition does not exist.
listEntryVersions
Section titled “listEntryVersions”const result = await lt.knowledge.listEntryVersions({ domain: 'catalog', key: 'materials' });List every edition of an entry, newest first, with the current one marked.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string |
Yes | Domain |
key |
string |
Yes | Entry key |
Returns: LTApiResult<{ domain, key, versions: [{ version, change_summary, created_at, is_current }] }>
storeEntry
Section titled “storeEntry”const result = await lt.knowledge.storeEntry({ domain: 'catalog', key: 'materials', data: { steel: { gauge: 14 }, aluminum: { gauge: 12 } }, tags: ['inventory'], replace: false,});Create or update an entry. Data merges into the existing entry by default; replace: true overwrites it.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string |
Yes | Domain |
key |
string |
Yes | Entry key |
data |
object |
Yes | JSONB data to store |
tags |
string[] |
No | Tags, unioned on upsert |
replace |
boolean |
No | Replace instead of merge |
Returns: LTApiResult<{ id, domain, key, created, updated_at }>
setField
Section titled “setField”const result = await lt.knowledge.setField({ domain: 'catalog', key: 'materials', path: 'steel.supplier', value: 'Acme Metals',});Set a value at a JSONB path, leaving sibling fields in place.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string |
Yes | Domain |
key |
string |
Yes | Entry key |
path |
string |
Yes | Dot-notation path |
value |
any |
Yes | Value to set (any JSON type) |
tags |
string[] |
No | Tags to union |
Returns: LTApiResult<{ id, domain, key, created, updated_at }>
removeField
Section titled “removeField”const result = await lt.knowledge.removeField({ domain: 'catalog', key: 'materials', path: 'aluminum',});Remove the field at a JSONB path.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string |
Yes | Domain |
key |
string |
Yes | Entry key |
path |
string |
Yes | Dot-notation path |
Returns: LTApiResult<{ removed }>
deleteEntry
Section titled “deleteEntry”const result = await lt.knowledge.deleteEntry({ domain: 'catalog', key: 'materials' });Permanently delete an entry.
Parameters
| Field | Type | Required | Description |
|---|---|---|---|
domain |
string |
Yes | Domain |
key |
string |
Yes | Entry key |
Returns: LTApiResult<{ deleted, domain, key }>
