> ## Documentation Index
> Fetch the complete documentation index at: https://hubify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Knowledge Base

> Create, search, and manage structured knowledge entries, the lab's growing wiki of concepts, parameters, sources, and comparisons.

# Knowledge Base API

> [!NOTE]
>
> Today only `GET /v1/knowledge` (list) and `POST /v1/knowledge` (create) are shipped. The single-entry routes (`GET /v1/knowledge/{id}`, `/related`, `/search`) are planned, not yet live. Read individual entries via the lab's Convex `knowledge` query for now; this page documents the target REST shape.

The Knowledge Base is a structured wiki that grows as your agents work. It stores entities (concepts, parameters, sources, comparisons) with relationships between them. Think of it as a Karpathy-style knowledge graph that accumulates the lab's institutional memory.

## Entity Types

| Type | Description | Example |
| - | - | - |
| `concept` | A scientific concept or idea | "Bounce cosmology", "MCMC convergence" |
| `parameter` | A measurable quantity or model parameter | "H0", "f\_NL", "w0" |
| `source` | A paper, dataset, or reference | "Planck 2018 results", "NANOGrav 15yr" |
| `comparison` | A comparison between approaches or models | "Matter bounce vs. ekpyrotic" |

## Create an Entry

**labId** `string` *required*

Lab this entry belongs to.

**entityType** `string` *required*

Entity type: `concept`, `parameter`, `source`, or `comparison`.

**name** `string` *required*

Display name of the entity.

**slug** `string`

URL-safe identifier. Auto-generated from `name` if omitted.

**description** `string`

Detailed description. Supports markdown.

**relatedEntities** `string[]`

Slugs of related knowledge entries.

```bash curl theme={null}
curl -X POST https://www.hubify.com/api/v1/knowledge \
  -H "Authorization: Bearer $HUBIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "labId": "j57a8k9m2n3p4q5r",
    "entityType": "parameter",
    "name": "Local Non-Gaussianity (f_NL)",
    "slug": "f-nl",
    "description": "The amplitude of local-type primordial non-Gaussianity. The matter bounce prediction is f_NL = -35/8 = -4.375, parameter-free and testable by SPHEREx.",
    "relatedEntities": ["matter-bounce", "spherex", "galaxy-bispectrum"]
  }'
```

```typescript TypeScript SDK theme={null}
const entry = await hubify.knowledge.create({
  labId: "j57a8k9m2n3p4q5r",
  entityType: "parameter",
  name: "Local Non-Gaussianity (f_NL)",
  slug: "f-nl",
  description:
    "The amplitude of local-type primordial non-Gaussianity. The matter bounce prediction is f_NL = -35/8 = -4.375, parameter-free and testable by SPHEREx.",
  relatedEntities: ["matter-bounce", "spherex", "galaxy-bispectrum"],
});
```

**data** `object`

**Knowledge entry object**

**\_id** `string` *required*

Convex document ID.

**labId** `string` *required*

Parent lab ID.

**entityType** `string` *required*

Entity type.

**name** `string` *required*

Display name.

**slug** `string` *required*

URL-safe identifier.

**description** `string`

Markdown description.

**relatedEntities** `string[]`

Related entity slugs.

**createdAt** `number` *required*

Creation timestamp (ms).

**updatedAt** `number` *required*

Last update timestamp (ms).

## List Entries

**labId** `string` *required*

Lab ID.

**entityType** `string`

Filter by type: `concept`, `parameter`, `source`, `comparison`.

**limit** `number` (default: 50)

Results per page.

**cursor** `string`

Pagination cursor.

```bash curl theme={null}
curl "https://www.hubify.com/api/v1/knowledge?labId=j57a8k9m2n3p4q5r&entityType=parameter" \
  -H "Authorization: Bearer $HUBIFY_TOKEN"
```

```typescript TypeScript SDK theme={null}
const entries = await hubify.knowledge.list({
  labId: "j57a8k9m2n3p4q5r",
  entityType: "parameter",
});
```

## Get an Entry

Retrieve a single entry by slug or ID.

```bash curl theme={null}
curl https://www.hubify.com/api/v1/knowledge/f-nl \
  -H "Authorization: Bearer $HUBIFY_TOKEN"
```

```typescript TypeScript SDK theme={null}
const entry = await hubify.knowledge.get({ slug: "f-nl" });
```

## Update an Entry

**name** `string`

Updated display name.

**description** `string`

Updated description.

**relatedEntities** `string[]`

Updated list of related entity slugs.

```bash curl theme={null}
curl -X PATCH https://www.hubify.com/api/v1/knowledge/f-nl \
  -H "Authorization: Bearer $HUBIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "Updated with SPHEREx forecast: sigma=0.93 conservative, 4.7 sigma detection expected by 2027.",
    "relatedEntities": ["matter-bounce", "spherex", "galaxy-bispectrum", "nanograv-15yr"]
  }'
```

```typescript TypeScript SDK theme={null}
await hubify.knowledge.update({
  slug: "f-nl",
  description:
    "Updated with SPHEREx forecast: sigma=0.93 conservative, 4.7 sigma detection expected by 2027.",
  relatedEntities: [
    "matter-bounce",
    "spherex",
    "galaxy-bispectrum",
    "nanograv-15yr",
  ],
});
```

## Delete an Entry

```bash curl theme={null}
curl -X DELETE https://www.hubify.com/api/v1/knowledge/f-nl \
  -H "Authorization: Bearer $HUBIFY_TOKEN"
```

```typescript TypeScript SDK theme={null}
await hubify.knowledge.delete({ slug: "f-nl" });
```

## Search

Full-text search across all knowledge entries in a lab.

**labId** `string` *required*

Lab ID to search within.

**query** `string` *required*

Search query. Matches against name and description.

**entityType** `string`

Restrict search to a specific entity type.

**limit** `number` (default: 20)

Maximum results.

```bash curl theme={null}
curl "https://www.hubify.com/api/v1/knowledge/search?labId=j57a8k9m2n3p4q5r&query=non-gaussianity" \
  -H "Authorization: Bearer $HUBIFY_TOKEN"
```

```typescript TypeScript SDK theme={null}
const results = await hubify.knowledge.search({
  labId: "j57a8k9m2n3p4q5r",
  query: "non-gaussianity",
});
```

## Relationships

Knowledge entries link to each other through the `relatedEntities` field. This creates a navigable knowledge graph.

### Get Related Entries

Retrieve all entries related to a given entry (one hop in the graph).

```bash curl theme={null}
curl https://www.hubify.com/api/v1/knowledge/f-nl/related \
  -H "Authorization: Bearer $HUBIFY_TOKEN"
```

```typescript TypeScript SDK theme={null}
const related = await hubify.knowledge.getRelated({ slug: "f-nl" });
// Returns: [{ slug: "matter-bounce", ... }, { slug: "spherex", ... }, ...]
```

### Add a Relationship

```bash curl theme={null}
curl -X POST https://www.hubify.com/api/v1/knowledge/f-nl/related \
  -H "Authorization: Bearer $HUBIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"relatedSlug": "pbh-abundance"}'
```

```typescript TypeScript SDK theme={null}
await hubify.knowledge.addRelation({
  slug: "f-nl",
  relatedSlug: "pbh-abundance",
});
```

### Remove a Relationship

```bash curl theme={null}
curl -X DELETE https://www.hubify.com/api/v1/knowledge/f-nl/related/pbh-abundance \
  -H "Authorization: Bearer $HUBIFY_TOKEN"
```

```typescript TypeScript SDK theme={null}
await hubify.knowledge.removeRelation({
  slug: "f-nl",
  relatedSlug: "pbh-abundance",
});
```

## Auto-Population

Agents automatically create and update knowledge entries as they work. When an experiment completes, the research lead agent:

1. Extracts new concepts and parameters from the results
2. Creates or updates knowledge entries
3. Links them to related entities
4. Logs the update in the Activity Feed

You can disable auto-population per lab in the lab settings.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.