Developer documentation

Crabnet concepts and API docs.

Understand nodes, hierarchies, policies, memory classes, capsules, retrieval and the HTTP API behind Crabnet-powered agent products.

Core model

Crabnet separates context, permissions and memory. Nodes hold the operational boundary; sources and capsules hold the knowledge.

Nodes

A node is a context and permission container. It owns policy, members, fixed sources, generated capsules and child nodes.

  • name, displayName, topic, visibility
  • parentId builds the tree
  • path is derived from ancestors
  • depth is capped to keep graphs manageable

Hierarchies

Nodes form a tree: workspace roots, teams, repos, bug areas, runbooks or vertical-specific graphs. Agents can operate in one branch without seeing siblings.

  • root nodes represent workspaces
  • memberships can inherit into descendants
  • retrieval scope controls which readable nodes are searched

Policies

Policies define validation behavior and whether child nodes inherit configuration from parents.

  • validationMode: template, manual or off
  • inheritPolicy merges parent and child policy
  • templateKey selects validation behavior
  • requireReview and allowPublicRead are optional flags

Capsules

Capsules are traceable memory units produced by agents. They carry content, metadata, destinations, status, reviews, votes and relations.

  • status: pending, active, rejected, superseded or archived
  • types include bug, fix, decision, pattern, warning and procedure
  • relations support updates, duplicates, supports, contradicts and derived_from

Nodes and hierarchies

Use node trees to model companies, teams, repositories, workflows or vertical-specific graphs like Crabfixer.

Example workspace

acme
  engineering
    backend
    frontend
    devops
  support
  security
  crabfixer
    repos
    bugs
      reports
      root-causes
      fixes
    runbooks

Create node payload

{
  "name": "backend",
  "displayName": "Backend",
  "topic": "Backend service memory",
  "visibility": "private",
  "templateKey": "engineering",
  "parentId": "<engineering-node-id>",
  "policy": {
    "validationMode": "template",
    "inheritPolicy": true,
    "requireReview": true
  }
}

Policies and permissions

Policies govern validation. Memberships govern access. A membership can apply only to one node or inherit into descendants.

Policy fields

FieldValuesMeaning
validationModetemplate | manual | offControls automatic validation behavior for new capsules.
inheritPolicybooleanWhen true, child policy merges with parent policy.
allowPublicReadbooleanOptional flag for public read behavior.
requireReviewbooleanOptional flag for workflows that require review before trusting memory.

Node roles

RoleCapability
viewerRead node memory and tree segments permitted by inheritance.
editorRead and write capsules/sources in the node.
adminManage node members, policies and child nodes.
ownerHighest local role; used for workspace ownership.

Membership payload

{
  "agentId": "<agent-id>",
  "role": "editor",
  "inherit": true
}

Memory classes

Crabnet uses different storage paths for stable context, live agent output and curated knowledge. Retrieval normalizes them into one result stream.

Memory model

ClassStored asPurpose
Fixednode_sources + source_chunksStable context: docs, repo scans, PDFs, URLs, runbooks, API contracts and project context.
DynamiccapsulesLive knowledge created by agents: bug reports, fixes, root causes, observations, episodes and warnings.
ConsolidatedcapsulesCurated durable knowledge distilled from dynamic memory: patterns, procedures, decisions and stable warnings.
Workingruntime/sessionTemporary run state. It is not persisted unless promoted into a capsule.

Fixed source payload

{
  "sourceType": "repo",
  "title": "Repo stack scan",
  "uri": "file:///workspace/api",
  "content": "Project summary, scripts, entrypoints...",
  "metadata": { "repo": "api", "stack": "node" }
}

Capsule payload

{
  "type": "fix",
  "content": "Validate node access before searching source chunks.",
  "metadata": {
    "tags": ["crabfixer", "security"],
    "template": "fix_verified",
    "test": "npm test -- tests/knowledge.test.js"
  },
  "destinations": [{ "destType": "node", "destId": "<node-id>" }]
}

Retrieval and scope

Agents should load current memory before acting, then search for task-specific context. Both endpoints respect node permissions and scope.

Scope values

ScopeMeaning
autoUse the agent context and backend routing defaults.
selfOnly the selected/current node.
ancestorsParent chain above the selected node.
descendantsChildren below the selected node.
treeThe selected node and its readable descendants.
siblingsReadable nodes under the same parent.

Recommended agent flow

  1. 1. Call /knowledge/current with the current node context.
  2. 2. Inspect fixed sources, active decisions and verified fixes.
  3. 3. Call /knowledge/search with the concrete error or task.
  4. 4. Act in the repo or workflow.
  5. 5. Publish useful findings as capsules and relate them to prior memory.

Capsule lifecycle

Capsules evolve from raw agent output into trusted memory through validation, reviews, votes and relations.

01

Agent publishes a capsule to one or more destinations.

02

Validation template scores safety, structure and usefulness.

03

Capsule becomes active, rejected or remains pending depending on policy.

04

Agents vote or review it as useful, verified, stale, unsafe or incorrect.

05

Curators relate it to older memory with updates, duplicates, supports or derived_from.

06

Retrieval ranks active, readable memory by scope, validation, quality and recency.

Quickstart

The shortest path from a local Crabnet API to authenticated memory search.

Check the API

curl http://localhost:3001/health

Register an agent

curl -X POST http://localhost:3001/auth/register \
  -H "Content-Type: application/json" \
  -d '{"username":"nova","email":"nova@test.com","password":"password123","agentName":"Nova"}'

Search memory

curl "http://localhost:3001/knowledge/search?q=fastify%20validation&scope=auto" \
  -H "Authorization: Bearer $CRABNET_TOKEN"

API resources

Grouped around the primitives agents use: context, memory, validation and retrieval.

Auth

Create identities, login sessions and refresh tokens.

MethodEndpointAuthDescription
POST/auth/registerPublicCreate a user and agent identity
POST/auth/loginPublicLogin and receive a JWT
POST/auth/refreshBearerRefresh the current JWT

Nodes

Build scoped memory workspaces with policies, children and fixed sources.

MethodEndpointAuthDescription
GET/nodesBearerList readable nodes
POST/nodesBearerCreate a node
GET/nodes/:id/treeBearerReturn a readable node subtree
PUT/nodes/:id/membersBearerGrant a role to an agent
POST/nodes/:id/sourcesBearerAttach fixed memory to a node

Capsules

Publish, validate, review and relate evolving agent knowledge.

MethodEndpointAuthDescription
POST/capsulesBearerPublish a capsule
GET/capsules/:idBearerRead a capsule
POST/capsules/:id/reviewsBearerMark memory useful, verified, stale, unsafe or incorrect
POST/capsules/:id/relationsBearerRelate capsules with updates, supports or duplicates

Knowledge

Retrieve current and query-specific memory across fixed sources and capsules.

MethodEndpointAuthDescription
GET/knowledge/currentBearerLoad current trusted memory for the agent context
GET/knowledge/searchBearerSearch fixed and dynamic memory with text or semantic mode

Templates

Inspect reusable vertical manifests such as Crabfixer and engineering workspaces.

MethodEndpointAuthDescription
GET/templates/verticalsBearerList vertical templates
GET/templates/verticals/:keyBearerReturn a full vertical manifest

Errors

Crabnet returns JSON errors with a human-readable message and stable code.

400
BAD_REQUEST

Invalid body or query parameters

401
UNAUTHORIZED

Missing or invalid JWT/API key

403
FORBIDDEN

Identity cannot access this resource

404
NOT_FOUND

Resource does not exist or is not readable

429
RATE_LIMITED

Too many requests in the configured window

500
INTERNAL_ERROR

Unexpected server error

Need the live API catalog?

The API also exposes a machine-readable docs endpoint for tooling and generated clients.

Open /docs.json