This guide will help you get started with Code Context Recorder and make the most of its features.
- Installation
- Quick Start
- VS Code Extension
- CLI Usage
- Git Integration
- Browser Extension
- Best Practices
- Advanced Usage
The easiest way to get started:
# From marketplace (coming soon)
code --install-extension code-context-recorder
# Or install from source
git clone https://github.com/yourusername/code-context-recorder.git
cd code-context-recorder
npm install
npm run build
cd packages/vscode-extension
npm run install-extensionnpm install -g @ccr/cli
# Or use locally in your project
npm install --save-dev @ccr/cli# In your project directory
npx ccr-hooks installcd your-project
ccr initThis creates a .ccrrc.json configuration file.
Via VS Code:
- Press
Ctrl+Shift+C(orCmd+Shift+Con Mac) - Enter your context
- Optionally add tags
Via CLI:
ccr add "Using Redis for caching because..." --file src/cache.ts --tags "decision,performance"Timeline view:
ccr timeline src/cache.tsSearch:
ccr search "redis caching"Ctrl+Shift+C: Add context to current fileCtrl+Shift+V: Add voice note (coming soon)Ctrl+Shift+T: View file timelineCtrl+Shift+F: Search contexts
The CCR sidebar shows:
- Recent Context: Last 10 context entries
- Current File Context: All context for the active file
- Statistics: Quick stats about your context
Hover over any line of code to see associated context automatically.
Right-click in any file to access CCR commands:
- Add Context
- Add Voice Note
- View Timeline
- Link Ticket
# Basic usage
ccr add "Context message" --file path/to/file.ts
# With line number
ccr add "Fixed bug in login" --file auth.ts --line 42
# With tags
ccr add "Refactored for performance" --file utils.ts --tags "refactor,perf"# Basic search
ccr search "authentication"
# Filter by file
ccr search "bug" --file "*.test.ts"
# Filter by type
ccr search "decision" --type decision
# Limit results
ccr search "refactor" --limit 5# View timeline for a file
ccr timeline src/components/Login.tsx
# Timeline for specific date range (coming soon)
ccr timeline src/api.ts --from 2024-01-01 --to 2024-02-01ccr stats
# Output:
# Total Contexts: 247
# Avg per Commit: 2.3
# Most Documented Files:
# - src/auth.ts (45)
# - src/api.ts (32)
# - src/utils.ts (28)When you commit, CCR can optionally prompt for additional context:
git commit -m "Add authentication"
# CCR prompts:
# Would you like to add additional context? [y/n/voice]:In .ccrrc.json:
{
"git": {
"promptOnCommit": true,
"autoCapture": true
}
}# View context for a specific commit
ccr show abc123
# List commits with context
ccr commits --with-contextThe browser extension (Chrome/Firefox) automatically tracks:
- Documentation pages you visit
- Stack Overflow questions
- GitHub issues and PRs
- Blog posts and tutorials
These are associated with your active file in VS Code.
-
Build the extension:
cd packages/browser-extension npm run build -
Load in browser:
- Chrome: Load
dist/as unpacked extension - Firefox: Load
dist/as temporary extension
- Chrome: Load
All browser history is stored locally and never sent to servers.
Configure what's tracked in settings:
{
"capture": {
"includeBrowserHistory": true,
"browserHistoryDomains": [
"stackoverflow.com",
"github.com",
"*.readthedocs.io"
]
}
}Good times to add context:
- ✅ Making a non-obvious decision
- ✅ Implementing a workaround
- ✅ Choosing between alternatives
- ✅ Fixing a subtle bug
- ✅ Using an unusual pattern
Don't add context for:
- ❌ Self-explanatory code
- ❌ Standard patterns
- ❌ Obvious implementations
Bad:
"Fixed bug"
Good:
"Fixed race condition in user login. The issue occurred when rapid
consecutive logins caused duplicate session creation. Solution:
added session locking using Redis distributed locks."
ccr add "Following the pattern from this article: https://..."Use the decision command for architecture choices:
ccr decision "Use PostgreSQL over MongoDB" \
--reasoning "Need ACID transactions for financial data" \
--alternatives "MongoDB,DynamoDB" \
--files "src/db/*.ts"Use consistent tags for easier searching:
decision- Architecture/tech decisionsworkaround- Temporary workaroundsbug-fix- Bug fixesperformance- Performance optimizationssecurity- Security-related changesrefactor- Code refactoring
Review and clean up old context:
# Find old unused context
ccr cleanup --older-than 6months --unusedShare context across team:
# Export contexts
ccr export --format json > contexts.json
# Import contexts
ccr import contexts.json{
"integrations": {
"slack": {
"enabled": true,
"webhook": "https://hooks.slack.com/..."
}
}
}Automatically posts to Slack when important decisions are recorded.
Link tickets automatically:
ccr link-ticket "PROJ-123" https://linear.app/... --file src/feature.tsUse the core API in your own scripts:
import { CodeContextRecorder, createDefaultConfig } from '@ccr/core';
const recorder = new CodeContextRecorder(createDefaultConfig('./'));
await recorder.initialize();
await recorder.addContext('Custom context', 'file.ts');# Generate report
ccr report --format html > report.html
# Find files with least context
ccr analyze --find-undocumented
# Team contributions
ccr contributors --since 2024-01-01This happens when multiple processes access the database:
# Close all VS Code windows
# Remove lock file
rm .ccr/contexts.db-wal# Reload VS Code
# Check output panel for errors
# Reinstall extension
code --uninstall-extension code-context-recorder
code --install-extension code-context-recorder# Reinstall hooks
npx ccr-hooks install --force
# Check hook is executable
chmod +x .git/hooks/post-commit- 📖 Documentation
- 💬 Discord Community
- 🐛 Report Issues
- ✉️ Email: [email protected]