Skip to content

Example: Knowledge Base

This example shows how to use the Knowledge Pool to create, link, query, and verify knowledge cards across a network of agents.

import { quickStart } from 'society-core/sdk';
const agent = await quickStart({
name: 'KnowledgeAgent',
room: 'knowledge-lab',
capabilities: ['research', 'knowledge-management'],
});

Knowledge cards are created automatically during workflow execution, but you can also create them programmatically via the Knowledge Pool:

// After a research workflow completes, findings are
// automatically stored as knowledge cards.
const chain = await agent.summon({
goal: 'Research current state of CRISPR gene therapy',
room: 'knowledge-lab',
template: 'literature_review',
});
// Execute all steps...
// Knowledge cards are created from high-confidence insights

Use persona_search_memories to search the knowledge base:

Search for knowledge cards about "CRISPR delivery mechanisms"
with confidence above 0.8
// Search using the persona vault
const memories = await agent.queryMemories({
query: 'CRISPR delivery mechanisms',
limit: 20,
});
for (const m of memories) {
console.log(`${m.title} (confidence: ${m.confidence})`);
}
// First workflow: CRISPR basics
await agent.summon({
goal: 'Review CRISPR-Cas9 mechanism and variants',
room: 'knowledge-lab',
template: 'research_swarm',
options: { domains: 3 },
});
// Second workflow: Delivery methods
await agent.summon({
goal: 'Survey CRISPR delivery mechanisms: viral, lipid, electroporation',
room: 'knowledge-lab',
template: 'research_swarm',
options: { domains: 3 },
});
// Third workflow: Clinical applications
await agent.summon({
goal: 'Review CRISPR clinical trials and therapeutic applications',
room: 'knowledge-lab',
template: 'literature_review',
});

Step 2: Cross-Reference with Hypothesis Testing

Section titled “Step 2: Cross-Reference with Hypothesis Testing”
// Generate and test hypotheses based on accumulated knowledge
await agent.summon({
goal: 'What is the most promising CRISPR delivery method for in vivo gene therapy?',
room: 'knowledge-lab',
template: 'hypothesis_swarm',
options: { domains: 4 },
});
// Start a mission to monitor new publications
const mission = await agent.startMission({
goal: 'Monitor new CRISPR gene therapy publications and clinical trial results',
room: 'knowledge-lab',
template: 'literature_review_continuous',
cadenceMs: 3600000, // Hourly cycles
policy: {
autonomy: 'semiautonomous',
approvalGates: ['publish'],
research: {
sources: ['pubmed', 'arxiv', 'semantic-scholar'],
subdomainsPerCycle: 4,
requireDualReview: true,
},
},
});
// Export a chain's results as a capsule
const capsulePath = await agent.exportCapsule(chain.chain_id, './kb-export');
console.log(`Knowledge exported to: ${capsulePath}`);

In a network with multiple agents, each agent contributes to the shared knowledge pool:

Agent A (Genetics Expert)
→ Creates cards about CRISPR variants
→ Verifies genetics-related cards
Agent B (Clinical Researcher)
→ Creates cards about clinical trials
→ Links trial results to mechanism cards
Agent C (Bioinformatics)
→ Creates cards about delivery methods
→ Runs computational analysis workflows
All cards sync via CRDTs across the network.

The Knowledge Pool’s CRDT synchronization ensures all agents see a consistent view of the knowledge base, even when agents go offline and reconnect.