memowiki
v1.0.7
Published
A persistent memory layer for your codebase + AI agent
Readme
MemoWiki
A persistent memory layer for your codebase - Automated documentation generation with LLM-powered insights, semantic search, and agent-driven summaries.
Overview
MemoWiki transforms your code into searchable, up-to-date documentation automatically. It leverages Large Language Models (LLMs) to generate comprehensive docs, diagrams, and summaries while intelligently caching results to minimize API usage.
Key Features
- ✅ Automated Documentation - Generate docs from code with LLM analysis
- ✅ Visual Diagrams - Mermaid class and architecture diagrams
- ✅ Semantic Search - Natural language code search with vector embeddings
- ✅ Agent Summaries - Track AI agent implementation progress
- ✅ Smart Caching - Avoid redundant API calls
- ✅ Git Integration - Auto-detect changes and track history
- ✅ Multi-LLM Support - OpenAI, Anthropic, Gemini, OpenRouter, Ollama
- ✅ REST API - Expose functionality for IDE/CI integrations
- ✅ Web Dashboard - Visual interface for monitoring and management
Quick Start
Installation
npm install -g memowikiConfiguration
Create a .env file:
LLM_PROVIDER=openai
OPENAI_API_KEY=your-api-key-here
OPENAI_MODEL=gpt-4-turbo-previewSee Configuration Guide for all providers.
Basic Usage
# Generate documentation for your codebase
memowiki update
# Record an agent implementation summary
memowiki record --type feature --output my-feature
# Query summaries
memowiki summaries --recent 5
# Search code semantically
memowiki search "authentication logic"
# Analyze repository
memowiki analyze
# Start API server (with integrated dashboard)
memowiki serve
# Build dashboard and backend
npm run build:allWeb Dashboard
MemoWiki now includes a web dashboard for visualizing and managing your codebase documentation.
Features
- Overview - Stats cards showing documented files, cache hit rate, and pending TODOs
- Documentation Browser - Browse and filter documentation status by file
- Summaries Timeline - View agent implementation summaries with filtering
- Settings - Manage LLM provider configuration
- Activity Feed - Track recent documentation updates
Quick Start
# Build both backend and dashboard
npm run build:all
# Start the server (serves both API and dashboard)
memowiki serve
# Access dashboard at http://localhost:3000Development Mode
# Terminal 1: Start backend API
memowiki serve
# Terminal 2: Start dashboard with hot-reload
cd dashboard
ng serve
# Access at http://localhost:4200Build Scripts
| Script | Description |
|--------|-------------|
| npm run build | Build backend only |
| npm run build:dashboard | Build dashboard only |
| npm run build:all | Build both backend and dashboard |
Commands
Core Commands
| Command | Description | Documentation |
|---------|-------------|---------------|
| update | Generate documentation for codebase | Guide |
| record | Create agent implementation summaries | Guide |
| summaries | Query agent summaries | Guide |
| search | Semantic code search | Guide |
| analyze | Git repository insights | Guide |
| serve | Start REST API server + dashboard | Guide |
| intent | Analyze code change intent | Guide |
Command Details
Update - Generate Documentation
memowiki update [--full] [--verbose]- Auto-detects changed files from git
- Generates markdown documentation
- Creates class and architecture diagrams
- Intelligently caches results
Record - Agent Summaries
memowiki record [-f files...] [-o name] [-t type] [--append]- Track AI agent implementation progress
- Identify TODOs, stubs, and completed work
- Create structured summaries with LLM analysis
- Support incremental documentation
Summaries - Query Agent Work
memowiki summaries [-f file] [-t type] [-r recent]- Efficient index-based filtering
- Query by file, type, or recency
- No need to parse all summary files
Search - Semantic Code Search
memowiki search <query> [-n limit]- Natural language queries
- Vector embedding similarity search
- Returns ranked results with snippets
Analyze - Repository Insights
memowiki analyze- View git repository status
- See recent commits and branch info
- Detect merge conflicts
Serve - API Server
memowiki serve [-p port]- REST API for external integrations
- IDE plugins and CI/CD pipelines
- Programmatic access to all features
Intent - Change Classification
memowiki intent- Analyze code change intent
- Classify as bug fix, feature, refactor, etc.
- Provide actionable suggestions
Documentation
Guides
- Configuration - LLM provider setup
- Dashboard - Web interface guide
- Update Command - Documentation generation
- Record Command - Agent summaries
- Summaries Command - Query summaries
- Search Command - Semantic search
- Analyze Command - Repository analysis
- Serve Command - API server
- Intent Command - Intent classification
Supported LLM Providers
| Provider | Setup | Best For | |----------|-------|----------| | OpenAI | Requires API key | Production quality | | Anthropic | Requires API key | Long context | | Gemini | Requires API key | Cost-effective | | OpenRouter | Requires API key | Model flexibility | | Ollama | Local install | Privacy, no limits | | Mock | No setup | Testing |
See Configuration Guide for detailed setup.
Output Structure
.codewiki/
├── memory/ # Individual file documentation
├── diagrams/ # Class diagrams
├── flows/ # Architecture diagrams
├── summaries/ # Project and agent summaries
│ ├── index.json # Summary metadata index
│ └── *.md # Summary files
└── cache.json # Documentation cacheUse Cases
For Developers
- Onboarding - New team members understand codebase quickly
- Documentation - Automated, always up-to-date
- Code Review - Context for pull requests
- Architecture - Visual system diagrams
For AI Agents
- Memory - Persistent knowledge of codebase
- Context - Understand system architecture
- Progress Tracking - Document implementation work
- TODO Management - Track incomplete work
For Teams
- Knowledge Sharing - Centralized code knowledge
- Change Tracking - Git-integrated documentation
- Search - Find code by natural language
- API Access - Integrate with existing tools
Programmatic Usage
import {
LLMService,
WikiManager,
SummaryGenerator,
SearchService,
GitService
} from 'memowiki';
// Generate documentation
const llmService = new LLMService(config);
const doc = await llmService.generateDocumentation(codeStructure, gitState);
// Create agent summary
const generator = new SummaryGenerator(llmService, config);
const summary = await generator.generateImplementationSummary(
['src/auth/login.ts'],
'feature'
);
// Search codebase
const searchService = new SearchService();
await searchService.initialize();
const results = await searchService.search('authentication', 10);
// Analyze git
const gitService = new GitService();
const gitState = await gitService.getGitState();Integration Examples
VS Code Extension
// Generate docs on save
vscode.workspace.onDidSaveTextDocument(async (document) => {
const response = await fetch('http://localhost:3000/api/v1/documentation', {
method: 'POST',
body: JSON.stringify({ file: document.fileName })
});
});GitHub Actions
- name: Generate Documentation
run: |
memowiki update
git add .codewiki
git commit -m "docs: update documentation"
git pushGit Hook
#!/bin/bash
# .git/hooks/post-commit
memowiki update
memowiki record --type featurePerformance
- Caching - Avoids redundant API calls (10-100x faster on unchanged files)
- Incremental Updates - Only processes changed files
- Parallel Processing - Concurrent LLM requests
- Smart Filtering - Respects
.gitignoreand.memowikiignore
Requirements
- Node.js 16+
- Git repository (optional but recommended)
- LLM provider API key (or Ollama for local)
- ChromaDB (optional, for semantic search)
Troubleshooting
# Clear cache
rm -rf .codewiki/cache.json
# Regenerate all docs
memowiki update --full
# Enable verbose logging
memowiki update --verbose
# Test configuration
memowiki analyzeContributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
License
MIT License - see LICENSE for details.
Support
Built with ❤️ for developers and AI agents
