A hybrid TypeScript-based educational agent combining structured tutor loops with knowledge graph navigation, focused on teaching computational neuroscience concepts toward understanding whole brain emulation (WBE).
This agent combines two pedagogical approaches:
- OpenAI Approach: Structured generate → evaluate → update loop with tight feedback cycles
- Anthropic Approach: Knowledge graph-based navigation with prerequisite awareness
The knowledge graph serves as an intelligent skill selector within the structured teaching loop:
1. GENERATE: SkillSelector queries KnowledgeGraph for eligible skills
→ DomainModule.generate() creates task using Claude
2. ATTEMPT: Learner provides response
3. EVALUATE: DomainModule.evaluate() assesses using Claude
4. UPDATE: LearnerStateManager updates mastery & error tracking
5. LOOP: Back to GENERATE with updated state
- 40 Computational Neuroscience Skills: From basic electrophysics to WBE computational requirements
- Knowledge Graph: 20 concept nodes with prerequisite relationships
- Adaptive Difficulty: Adjusts based on learner performance
- Error Pattern Recognition: Identifies and remediates repeated mistakes
- Progress Tracking: Monitors mastery levels and learning trajectory
- Claude-Powered: Uses Claude 4.5 Sonnet for task generation and evaluation
edu-agent/
├── src/
│ ├── types/ # TypeScript type definitions
│ │ ├── task.types.ts # Task, TaskRequest, TaskMode
│ │ ├── eval.types.ts # EvalResult, ErrorTag
│ │ ├── learner.types.ts # LearnerState, MasteryEstimate
│ │ ├── graph.types.ts # ConceptNode, Relationship
│ │ └── domain.types.ts # DomainModule interface
│ ├── core/ # Domain-agnostic teaching loop
│ │ ├── CoreLoop.ts # Main orchestration
│ │ ├── LearnerStateManager.ts # State persistence
│ │ └── SkillSelector.ts # Graph-based skill selection
│ ├── graph/ # Knowledge graph
│ │ ├── KnowledgeGraph.ts # Graph data structure
│ │ ├── GraphNavigator.ts # Path finding, prereqs
│ │ └── data/
│ │ └── comp-neuro-graph.json # 20 concept nodes
│ ├── domain/ # Computational neuroscience
│ │ ├── CompNeuroDomain.ts # Domain implementation
│ │ ├── TaskGenerator.ts # Claude-based generation
│ │ ├── TaskEvaluator.ts # Claude-based evaluation
│ │ ├── skills.ts # 40 skill definitions
│ │ └── error-tags.ts # Common error patterns
│ ├── llm/ # LLM integration
│ │ ├── AnthropicClient.ts # Claude SDK wrapper
│ │ └── prompts/ # Prompt templates
│ └── index.ts # Main entry point
└── data/
└── learner-states/ # Persisted learner data
- Node.js 18+ and npm
- Anthropic API key (Claude access)
- Clone the repository:
git clone <your-repo-url>
cd edu-agent- Install dependencies:
npm install- Create environment file:
cp .env.example .env- Add your Anthropic API key to
.env:
ANTHROPIC_API_KEY=your_api_key_here
- Build the project:
npm run buildRun the demo session:
npm startThis will:
- Initialize the educational agent
- Create or load a demo learner
- Generate a computational neuroscience task
- Simulate a learner attempt
- Evaluate the attempt and provide feedback
- Display progress metrics
import {
AnthropicClient,
KnowledgeGraph,
CompNeuroDomain,
LearnerStateManager,
SkillSelector,
CoreLoop,
} from './src';
// Initialize components
const llmClient = new AnthropicClient(process.env.ANTHROPIC_API_KEY!);
const graph = await KnowledgeGraph.loadFromFile('./src/graph/data/comp-neuro-graph.json');
const domain = new CompNeuroDomain(llmClient, graph);
const stateManager = new LearnerStateManager('./data/learner-states');
const skillSelector = new SkillSelector(graph);
const coreLoop = new CoreLoop(domain, stateManager, skillSelector);
// Create a learner
await coreLoop.initializeLearner('student-1', 'Learn about WBE');
// Generate a task
const task = await coreLoop.generateTask('student-1', 'practice');
// Evaluate an attempt
const evaluation = await coreLoop.evaluateAttempt(
'student-1',
task,
learnerAttempt
);
// Get progress
const progress = await coreLoop.calculateProgress('student-1');Main orchestrator for the teaching loop.
Methods:
initializeLearner(id, goal)- Create new learnergenerateTask(id, mode)- Generate next task ('practice' | 'test' | 'transfer')evaluateAttempt(id, task, attempt)- Evaluate learner's responseteachingCycle(id, previousAttempt?, mode?)- Complete cycle (evaluate + generate)getLearnerSummary(id)- Get learner statisticscalculateProgress(id)- Progress toward WBE understanding (0-1)getSuggestedConcepts(id, count)- Get next recommended concepts
Tracks both short-term (recent tasks, errors) and long-term (goal, mastery) learning data.
Key Fields:
recentTasks: Task[]- Last 10 tasksrecentErrors: ErrorTag[]- Last 10 errorsmasteryEstimates: Map<skillId, MasteryEstimate>- Per-skill mastery (0-1)goal: string- Learning objectivecurrentFocus: string- Current concept nodedemonstratedUnderstanding: Set<skillId>- Skills with high mastery
Concept graph with 20 nodes and prerequisite relationships.
Methods:
getNode(id)- Get concept nodegetPrerequisites(nodeId)- Get prerequisite conceptsgetDescendants(nodeId)- Get concepts this leads togetSkillsForConcept(nodeId)- Get associated skillsfindConceptsForSkill(skillId)- Find concept containing skill
Foundational (1-2):
- Ohm's law for membranes
- Capacitance concept
- Time constant calculation
- Dimensional analysis
- Steady state voltage
Membrane Dynamics (2-3):
- Membrane differential equation
- Time constant interpretation
- Voltage/current clamp analysis
- Exponential decay pattern
- Subthreshold integration
Spike Generation (3-4):
- LIF model implementation
- Reset mechanism
- Refractory period
- Spike train analysis
- F-I curve derivation
Stochastic Processes (3-4):
- Poisson spike generation
- Rate coding vs temporal coding
- Coefficient of variation
- Fano factor
Synaptic Dynamics (3-4):
- Exponential/alpha synapse models
- EPSP amplitude
- Synaptic integration
- STDP rule and window
Numerical Methods (4-5):
- Euler method
- Runge-Kutta implementation
- Timestep selection
- Numerical stability analysis
- Computational cost analysis
WBE-Specific (4-5):
- Neuron model complexity
- Scaling analysis (1 → 1M neurons)
- Parallelization potential
- Fidelity tradeoffs
- WBE computational requirements
20 concept nodes organized from basic electrophysics to WBE requirements, with 35 prerequisite/related edges. Concepts are tagged by WBE relevance (core/supporting/advanced) and computational cost.
The knowledge graph is queried by SkillSelector to filter eligible skills based on prerequisites. It's not a separate curriculum engine.
- Skills (e.g., "time-constant-calculation") are task generation targets
- Concepts (e.g., "membrane-time-constant") are graph nodes grouping related skills
V1 uses Claude 4.5 Sonnet for both operations. Separate prompt templates allow easy optimization later.
Learner state stored as JSON files (one per learner). Simple, debuggable, no database overhead.
mastery = 0.7 * mastery + 0.3 * score - simple and responsive to recent performance.
if (repeatedErrors) → remediation tasks for that error
else if (recentSuccess && mode='transfer') → related skill at similar difficulty
else → next in prerequisite chain
After implementation, V1 succeeds if:
- ✅ Functional Loop: Can run 10+ generate→evaluate→update cycles
- ✅ Prerequisite Awareness: Doesn't assign advanced tasks before basics
- ✅ Remediation: Repeated errors trigger related skill tasks
- ✅ Transfer: Success on skill A leads to related skill B
- ✅ State Persistence: Learner state saves/loads correctly
- ✅ Pedagogical Quality: Tasks are clear, hints are useful
- Misconception detection (not just error tags)
- Confidence-based hint generation
- Careless error vs. misunderstanding distinction
- Forgetting curve tracking
- Scheduled review tasks
- Long-term retention metrics
- Jupyter notebook integration
- Neuron simulation tasks
- Parameter sweep exercises
- Plot-based questions (raster plots, f-I curves)
- Visual debugging tasks
- Interactive simulations
npm run buildnpm startnpm run cleanMIT
Contributions welcome! This is a V1 implementation with room for improvement in:
- Domain-specific task quality
- Prompt engineering
- Additional subject domains
- Advanced pedagogical features
- Based on design principles from OpenAI and Anthropic educational agent approaches
- Focused on computational neuroscience concepts from Dayan & Abbott, Gerstner et al.
- Whole brain emulation concepts from Sandberg & Bostrom