Cognitive Agent Framework Copilot
Development assistant for building and working with the Cognitive Agent Framework - a TypeScript-based multi-agent system with LLM integration, task management, memory systems, and tool execution capabilities.
What This Skill Does
This skill guides you through developing, extending, and using the Cognitive Agent Framework. It helps with project scaffolding, agent implementation, LLM provider integration, memory system configuration, tool development, and documentation maintenance.
Instructions
1. Project Requirements Understanding
When working with this framework, understand these core components:
**Multi-Agent Architecture**: TypeScript-based framework supporting multiple concurrent agents**LLM Integration**: Support for various language model providers (OpenAI, Anthropic, etc.)**Task Management**: Queue-based task scheduling and execution system**Memory System**: Persistent and working memory for agents**Tool Execution**: Extensible tool system for agent capabilities**Type Safety**: Full TypeScript implementation with strict typing2. Project Structure
Ensure the project follows this structure:
```
/src
/agents - Agent implementations
/llm - LLM provider integrations
/memory - Memory system components
/tools - Tool definitions and executors
/tasks - Task management
/config - Configuration files
/examples - Example agent implementations
/docs - Documentation
```
3. Development Workflow
Follow this sequence for development:
#### Initial Setup
1. Verify `.github/copilot-instructions.md` exists
2. Review and understand project requirements
3. Scaffold project structure if not present
4. Install dependencies: `npm install` or `yarn install`
5. Compile TypeScript: `npm run build` or `tsc`
#### Core Development Tasks
Implement agent base classes with proper interfacesCreate LLM provider adapters following the common interfaceBuild memory persistence layer with read/write capabilitiesDevelop tools with input validation and error handlingImplement task queue and execution logic#### Testing & Documentation
Create example agents demonstrating framework capabilitiesWrite unit tests for core componentsUpdate README.md with usage examplesMaintain QUICKSTART.md for new usersDocument API changes in relevant files4. Code Generation Guidelines
When generating code for this framework:
**Agent Implementation:**
Extend base Agent classImplement required lifecycle methods (initialize, execute, cleanup)Define agent capabilities and toolsHandle memory persistenceImplement error recovery**LLM Provider Integration:**
Follow provider interface contractHandle authentication and API keys securelyImplement retry logic and rate limitingSupport streaming responses where applicableNormalize provider-specific responses**Tool Development:**
Define clear input/output schemasValidate inputs before executionProvide detailed error messagesSupport async operationsDocument tool capabilities**Memory System:**
Support both working and long-term memoryImplement efficient retrieval mechanismsHandle serialization/deserializationSupport memory pruning and archivalMaintain memory consistency5. VS Code Tasks
Create and use these tasks in `.vscode/tasks.json`:
```json
{
"label": "Build Framework",
"type": "npm",
"script": "build"
}
{
"label": "Run Tests",
"type": "npm",
"script": "test"
}
{
"label": "Run Example Agent",
"type": "npm",
"script": "example"
}
```
6. Quality Checklist
Before considering work complete:
[ ] All TypeScript compiles without errors[ ] Core components implemented and tested[ ] Example agents demonstrate key features[ ] Documentation updated (README.md, QUICKSTART.md)[ ] API changes documented[ ] Error handling implemented[ ] Type definitions complete[ ] Dependencies up to date7. Common Patterns
**Agent Creation:**
```typescript
class MyAgent extends BaseAgent {
async initialize() { /* setup */ }
async execute(task: Task) { /* logic */ }
async cleanup() { /* teardown */ }
}
```
**Tool Registration:**
```typescript
registerTool({
name: "tool-name",
description: "What it does",
schema: { /* input schema */ },
execute: async (input) => { /* implementation */ }
})
```
**Memory Access:**
```typescript
await agent.memory.store(key, value)
const data = await agent.memory.retrieve(key)
```
8. Documentation Standards
Maintain these documentation files:
**README.md**: Overview, features, installation, basic usage**QUICKSTART.md**: Step-by-step guide for new users**API.md**: Detailed API reference**EXAMPLES.md**: Code examples and use cases**CONTRIBUTING.md**: Contribution guidelines9. Best Practices
Use TypeScript strict mode for type safetyImplement proper error boundariesLog important events and errorsSupport graceful degradationMake components testable and mockableFollow SOLID principlesDocument complex logic with commentsUse dependency injection where appropriateConstraints
Must use TypeScript for all source codeMaintain backward compatibility for public APIsFollow existing code style and conventionsAll new features require testsBreaking changes require major version bumpSecurity: Never commit API keys or secretsPerformance: Optimize memory usage and response times