|
| 1 | +# Contributing to Synapse Context Engine |
| 2 | + |
| 3 | +Thank you for your interest in contributing to SCE! This project welcomes contributions from researchers, developers, and AI safety practitioners. |
| 4 | + |
| 5 | +## 🎯 Ways to Contribute |
| 6 | + |
| 7 | +### 🐛 Bug Reports |
| 8 | +Found a bug? [Open an issue](https://github.com/sasus-dev/synapse-context-engine/issues/new?template=bug_report.md) with: |
| 9 | +- Clear description of the issue |
| 10 | +- Steps to reproduce |
| 11 | +- Expected vs actual behavior |
| 12 | +- Environment details (OS, browser, Node version) |
| 13 | +- Screenshots/logs if applicable |
| 14 | + |
| 15 | +### 💡 Feature Requests |
| 16 | +Have an idea? [Start a discussion](https://github.com/sasus-dev/synapse-context-engine/discussions/new?category=ideas) or [open a feature request](https://github.com/sasus-dev/synapse-context-engine/issues/new?template=feature_request.md). |
| 17 | + |
| 18 | +### 📊 Research Contributions |
| 19 | +- Benchmark results comparing SCE to RAG or other memory systems |
| 20 | +- Parameter sensitivity analyses |
| 21 | +- Scalability test results |
| 22 | +- AI safety case studies |
| 23 | +- Theoretical improvements |
| 24 | + |
| 25 | +### 🔬 Code Contributions |
| 26 | +- Performance optimizations |
| 27 | +- New algorithms or pruning strategies |
| 28 | +- UI/UX improvements |
| 29 | +- Test coverage |
| 30 | +- Documentation |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 🚀 Getting Started |
| 35 | + |
| 36 | +### Prerequisites |
| 37 | +- Node.js 18+ and npm |
| 38 | +- Git |
| 39 | +- For desktop builds: [Rust](https://rustup.rs) + platform dependencies |
| 40 | + - Windows: [C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) |
| 41 | + - macOS: Xcode Command Line Tools |
| 42 | + - Linux: `webkit2gtk` development packages |
| 43 | + |
| 44 | +### Setup Development Environment |
| 45 | + |
| 46 | +```bash |
| 47 | +# 1. Fork the repository on GitHub |
| 48 | +# 2. Clone your fork |
| 49 | +git clone https://github.com/YOUR_USERNAME/synapse-context-engine.git |
| 50 | +cd synapse-context-engine |
| 51 | + |
| 52 | +# 3. Install dependencies |
| 53 | +npm install |
| 54 | + |
| 55 | +# 4. Run web version |
| 56 | +npm run dev |
| 57 | + |
| 58 | +# 5. Run desktop version (requires Rust) |
| 59 | +npm run tauri dev |
| 60 | +``` |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +## 📝 Development Workflow |
| 65 | + |
| 66 | +### Branch Naming Convention |
| 67 | +- `feature/` - New features (`feature/goal-directed-activation`) |
| 68 | +- `fix/` - Bug fixes (`fix/traversal-depth-limit`) |
| 69 | +- `docs/` - Documentation (`docs/update-architecture-guide`) |
| 70 | +- `perf/` - Performance improvements (`perf/optimize-graph-traversal`) |
| 71 | +- `test/` - Test additions (`test/hebbian-learning-suite`) |
| 72 | + |
| 73 | +### Commit Messages |
| 74 | +Follow [Conventional Commits](https://www.conventionalcommits.org/): |
| 75 | + |
| 76 | +``` |
| 77 | +feat: add contradiction resolution UI |
| 78 | +fix: prevent infinite loop in recursive traversal |
| 79 | +docs: update spreading activation documentation |
| 80 | +perf: optimize hyperedge lookups with indexing |
| 81 | +test: add integration tests for MMR pruning |
| 82 | +``` |
| 83 | + |
| 84 | +### Pull Request Process |
| 85 | + |
| 86 | +1. **Create a feature branch** from `main` |
| 87 | + ```bash |
| 88 | + git checkout -b feature/your-feature-name |
| 89 | + ``` |
| 90 | + |
| 91 | +2. **Make your changes** with clear, atomic commits |
| 92 | + |
| 93 | +3. **Test thoroughly** |
| 94 | + ```bash |
| 95 | + npm test # Run test suite |
| 96 | + npm run lint # Check code style |
| 97 | + npm run type-check # TypeScript validation |
| 98 | + ``` |
| 99 | + |
| 100 | +4. **Update documentation** if needed |
| 101 | + - README.md for user-facing changes |
| 102 | + - Code comments for complex logic |
| 103 | + - docs/ for architectural changes |
| 104 | + |
| 105 | +5. **Open a Pull Request** with: |
| 106 | + - Clear title describing the change |
| 107 | + - Detailed description of what and why |
| 108 | + - Screenshots/videos for UI changes |
| 109 | + - Reference related issues (`Fixes #123`) |
| 110 | + - Test results if applicable |
| 111 | + |
| 112 | +6. **Respond to review feedback** promptly |
| 113 | + |
| 114 | +--- |
| 115 | + |
| 116 | +## 🧪 Testing Guidelines |
| 117 | + |
| 118 | +### Test Structure |
| 119 | +```typescript |
| 120 | +// tests/engine/spreading-activation.test.ts |
| 121 | +describe('Spreading Activation', () => { |
| 122 | + it('should propagate energy with decay', () => { |
| 123 | + // Arrange |
| 124 | + const graph = createTestGraph(); |
| 125 | + const seedNode = 'node-a'; |
| 126 | + |
| 127 | + // Act |
| 128 | + const results = spreadActivation(graph, seedNode, { gamma: 0.8 }); |
| 129 | + |
| 130 | + // Assert |
| 131 | + expect(results.get('node-b').energy).toBeLessThan(1.0); |
| 132 | + }); |
| 133 | +}); |
| 134 | +``` |
| 135 | + |
| 136 | +### Running Tests |
| 137 | +```bash |
| 138 | +npm test # All tests |
| 139 | +npm test -- --watch # Watch mode |
| 140 | +npm test spreading # Specific test file |
| 141 | +npm run test:coverage # Coverage report |
| 142 | +``` |
| 143 | + |
| 144 | +--- |
| 145 | + |
| 146 | +## 🎨 Code Style |
| 147 | + |
| 148 | +### TypeScript |
| 149 | +- Use TypeScript strict mode |
| 150 | +- Prefer explicit types over `any` |
| 151 | +- Use functional programming patterns where appropriate |
| 152 | +- Keep functions small and focused |
| 153 | + |
| 154 | +### React Components |
| 155 | +```typescript |
| 156 | +// ✅ Good |
| 157 | +interface NodeProps { |
| 158 | + id: string; |
| 159 | + energy: number; |
| 160 | + onActivate: (id: string) => void; |
| 161 | +} |
| 162 | + |
| 163 | +export const Node: React.FC<NodeProps> = ({ id, energy, onActivate }) => { |
| 164 | + return ( |
| 165 | + <div className="node" onClick={() => onActivate(id)}> |
| 166 | + <span>{id}</span> |
| 167 | + <span>{energy.toFixed(2)}</span> |
| 168 | + </div> |
| 169 | + ); |
| 170 | +}; |
| 171 | + |
| 172 | +// ❌ Avoid |
| 173 | +export const Node = (props: any) => { |
| 174 | + // ... |
| 175 | +}; |
| 176 | +``` |
| 177 | + |
| 178 | +### Naming Conventions |
| 179 | +- **Components**: PascalCase (`NodeVisualizer`, `GraphExplorer`) |
| 180 | +- **Functions**: camelCase (`spreadActivation`, `calculateMMR`) |
| 181 | +- **Constants**: UPPER_SNAKE_CASE (`DEFAULT_DECAY`, `MAX_DEPTH`) |
| 182 | +- **Types/Interfaces**: PascalCase (`HypergraphNode`, `ActivationResult`) |
| 183 | + |
| 184 | +--- |
| 185 | + |
| 186 | +## 📊 Performance Guidelines |
| 187 | + |
| 188 | +- Use `React.memo` for expensive components |
| 189 | +- Debounce frequent user interactions |
| 190 | +- Implement pagination for large node lists |
| 191 | +- Profile before optimizing (use Chrome DevTools) |
| 192 | +- Document performance-critical code sections |
| 193 | + |
| 194 | +```typescript |
| 195 | +// Example: Memoized graph calculation |
| 196 | +const activatedNodes = useMemo( |
| 197 | + () => spreadActivation(graph, focusNode, config), |
| 198 | + [graph, focusNode, config] |
| 199 | +); |
| 200 | +``` |
| 201 | + |
| 202 | +--- |
| 203 | + |
| 204 | +## 🔬 Research Contributions |
| 205 | + |
| 206 | +### Benchmark Submissions |
| 207 | +Include: |
| 208 | +- Methodology description |
| 209 | +- Dataset characteristics |
| 210 | +- Hardware specs |
| 211 | +- Full result tables |
| 212 | +- Statistical significance tests |
| 213 | +- Comparison with baselines |
| 214 | + |
| 215 | +### Theoretical Improvements |
| 216 | +- Mathematical derivation |
| 217 | +- Complexity analysis |
| 218 | +- Connection to existing literature |
| 219 | +- Implementation sketch |
| 220 | + |
| 221 | +--- |
| 222 | + |
| 223 | +## 📚 Documentation |
| 224 | + |
| 225 | +### Code Documentation |
| 226 | +```typescript |
| 227 | +/** |
| 228 | + * Propagates activation energy through the hypergraph using spreading activation. |
| 229 | + * |
| 230 | + * @param graph - The hypergraph structure |
| 231 | + * @param seedNodes - Initial activation points |
| 232 | + * @param config - Activation parameters (decay, threshold, depth) |
| 233 | + * @returns Map of node IDs to activation energies |
| 234 | + * |
| 235 | + * @example |
| 236 | + * ```typescript |
| 237 | + * const results = spreadActivation(graph, ['node-1'], { |
| 238 | + * gamma: 0.85, |
| 239 | + * theta: 0.3, |
| 240 | + * maxDepth: 3 |
| 241 | + * }); |
| 242 | + * ``` |
| 243 | + */ |
| 244 | +export function spreadActivation( |
| 245 | + graph: Hypergraph, |
| 246 | + seedNodes: string[], |
| 247 | + config: ActivationConfig |
| 248 | +): Map<string, number> { |
| 249 | + // Implementation |
| 250 | +} |
| 251 | +``` |
| 252 | + |
| 253 | +### Architecture Decisions |
| 254 | +Document significant architectural choices in `docs/architecture/decisions/`: |
| 255 | +```markdown |
| 256 | +# ADR 001: Use Hypergraphs Over Knowledge Graphs |
| 257 | + |
| 258 | +## Context |
| 259 | +Traditional knowledge graphs use binary relations... |
| 260 | + |
| 261 | +## Decision |
| 262 | +We will use directed hypergraphs to model memory... |
| 263 | + |
| 264 | +## Consequences |
| 265 | +- Preserves semantic atomicity |
| 266 | +- Requires custom traversal algorithms |
| 267 | +- Higher memory overhead |
| 268 | +``` |
| 269 | + |
| 270 | +--- |
| 271 | + |
| 272 | +## 🤝 Code of Conduct |
| 273 | + |
| 274 | +### Our Standards |
| 275 | +- Be respectful and inclusive |
| 276 | +- Welcome newcomers warmly |
| 277 | +- Provide constructive feedback |
| 278 | +- Focus on the problem, not the person |
| 279 | +- Respect different viewpoints and experiences |
| 280 | + |
| 281 | +### Unacceptable Behavior |
| 282 | +- Harassment or discriminatory language |
| 283 | +- Personal attacks or trolling |
| 284 | +- Publishing others' private information |
| 285 | +- Unethical or illegal activity |
| 286 | + |
| 287 | +### Enforcement |
| 288 | +Violations should be reported to the project maintainer. All complaints will be reviewed and investigated. |
| 289 | + |
| 290 | +--- |
| 291 | + |
| 292 | +## 🎓 Learning Resources |
| 293 | + |
| 294 | +New to the project? Start here: |
| 295 | +1. [Architecture Paper](docs/Synapse_Context_Engine_SCE.pdf) - Theoretical foundation |
| 296 | +2. [Open Questions](docs/questions/Questions_01.md) - Research opportunities |
| 297 | +3. [Latest Updates](docs/updates/) - Recent changes |
| 298 | +4. [Code Structure](docs/architecture/code-structure.md) - Codebase overview |
| 299 | + |
| 300 | +--- |
| 301 | + |
| 302 | +## 📞 Getting Help |
| 303 | + |
| 304 | +- **Questions**: [GitHub Discussions](https://github.com/sasus-dev/synapse-context-engine/discussions) |
| 305 | +- **Bugs**: [Issue Tracker](https://github.com/sasus-dev/synapse-context-engine/issues) |
| 306 | +- **Security**: See [SECURITY.md](SECURITY.md) |
| 307 | + |
| 308 | +--- |
| 309 | + |
| 310 | +## 🙏 Recognition |
| 311 | + |
| 312 | +Contributors are recognized in: |
| 313 | +- Repository README |
| 314 | +- Release notes |
| 315 | +- Academic publications (for significant research contributions) |
| 316 | + |
| 317 | +--- |
| 318 | + |
| 319 | +Thank you for contributing to advancing transparent AI memory systems! 🧠✨ |
0 commit comments