Contributing
Thank you for considering contributing to miniature-guacamole. We welcome contributions from developers who want to improve the agent system, add new features, or fix bugs.
Quick Links
How to Contribute
- Fork the repository
- Create a feature branch following our naming convention
- Write tests first (misuse-first ordering)
- Implement your changes
- Ensure all tests pass with 99% coverage
- Submit a pull request
Development Setup
Prerequisites
- Node.js 20+ and npm
- Git
- Claude Code CLI (for testing agents)
Installation
git clone https://github.com/wonton-web-works/miniature-guacamole.git
cd miniature-guacamole
npm installBuilding and Testing Your Changes
# Build the distribution
./build.sh
# Install to a test project
dist/miniature-guacamole/install.sh /path/to/test-project
# Or use the global install flow
bash dist/miniature-guacamole/web-install.sh --force
mg-init /path/to/test-projectRunning Tests
# Run all tests
npm test
# Run unit tests only
npm run test:unit
# Run integration tests
npm run test:integration
# Watch mode for development
npm run test:watch
# Generate coverage report
npm run test:coverageProject Structure
src/
├── framework/ # Framework source (agents, skills, shared, scripts, hooks)
├── installer/ # Install, uninstall, web-install, mg-init, mg-migrate
├── memory/ # Shared memory TypeScript layer
├── audit/ # Audit logging TypeScript layer
├── returns/ # Structured return envelopes
└── supervisor/ # Depth/loop monitoring
.claude/ # Dev environment (symlinks → src/framework/)
├── agents → ../src/framework/agents
├── skills → ../src/framework/skills
├── shared → ../src/framework/shared
├── scripts → ../src/framework/scripts
└── memory/ # Runtime state (gitignored)
tests/
├── unit/ # Unit tests for individual modules
├── integration/ # Integration tests for workflows
└── scripts/ # BATS tests for mg-* scriptsCoding Standards
Constraint-Driven Development (CAD)
We follow strict test-first practices:
- Write tests before code (RED phase)
- Write minimal code to pass tests (GREEN phase)
- Refactor while keeping tests green (REFACTOR phase)
- All features must have tests before implementation
Test Coverage
- Maintain 99% test coverage across the codebase
- No exceptions - coverage must not drop below 99%
- Use
npm run test:coverageto verify before submitting PRs
Code Quality
- DRY (Don't Repeat Yourself) - Extract duplication immediately into reusable functions
- Config over composition - Prefer configuration objects over complex inheritance
- Type-safe - Use TypeScript with strict mode enabled
- Clear naming - Functions and variables should be self-documenting
- Small functions - Keep functions focused and under 50 lines
Branch Naming Convention
Use the following format for branch names:
<type>/<workstream-id>-<brief-description>Types:
feat/- New featuresfix/- Bug fixesrefactor/- Code refactoringdocs/- Documentation changestest/- Test additions or modificationschore/- Maintenance tasks
Examples:
feat/ws-1-login-endpointfix/ws-5-memory-leakrefactor/ws-10-config-moduledocs/update-readme
Commit Message Format
Follow the conventional commit format used throughout the project:
<type>(<scope>): <description>
[optional body]
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>Types:
feat- New featurefix- Bug fixrefactor- Code refactoringtest- Test additions/updatesdocs- Documentation changeschore- Maintenance tasks
Scope examples: dashboard, memory, audit, skills, agents
Example commits:
feat(auth): add login endpoint with JWT support
fix(memory): resolve race condition in file locking
refactor(skills): optimize model usage with Sonnet+escalation protocol
docs(readme): update installation instructions
test(memory): add concurrent write testsPull Request Process
- Update tests - Add or update tests for your changes
- Verify coverage - Run
npm run test:coverageand ensure 99% coverage - Update documentation - Update README.md or relevant docs if needed
- Self-review - Review your own changes before submitting
- Create PR - Use a clear, descriptive title and provide context in the description
- Address feedback - Respond to review comments and make requested changes
PR Title Format
Keep titles under 70 characters and descriptive:
feat: Add two-factor authentication support
fix: Resolve memory leak in shared state
refactor: Extract config validation into modulePR Description Template
## Summary
Brief description of what this PR does and why.
## Changes
- Bullet point list of key changes
- Keep it focused and clear
## Test Plan
- [ ] All existing tests pass
- [ ] New tests added for new functionality
- [ ] Coverage remains at 99%+
- [ ] Manually tested feature X
- [ ] Verified no regressions
## Related Issues
Closes #123Code Review Expectations
For Authors
- Respond to feedback within 48 hours
- Be open to suggestions and alternative approaches
- Keep PRs focused - one feature/fix per PR
- Update your PR as you receive feedback
For Reviewers
- Review within 48 hours of PR submission
- Be constructive and specific in feedback
- Approve when code meets standards
- Request changes if standards not met
Adding New Features
Adding a New Agent
Create skill definition:
bashmkdir -p src/framework/skills/<agent-name> # Create src/framework/skills/<agent-name>/SKILL.mdCreate subagent definition (if IC):
bashmkdir -p src/framework/agents/<agent-name> # Create src/framework/agents/<agent-name>/agent.mdUpdate delegation hierarchy:
- Edit
src/framework/shared/handoff-protocol.md - Update delegation authority matrix
- Edit
Add tests:
bash# Create tests/unit/agents/<agent-name>.test.ts # Verify delegation patterns workUpdate documentation:
- Add agent to README.md agent roster
- Add to
src/framework/CLAUDE.md - Update architecture diagrams
Adding a New Workflow
Create workflow skill:
bashmkdir -p src/framework/skills/<workflow-name> # Create src/framework/skills/<workflow-name>/SKILL.mdDefine workflow steps:
- Document agent spawning logic
- Define memory read/write protocol
- Specify success criteria
Add integration tests:
bash# Create tests/integration/<workflow-name>.test.ts # Test complete workflow executionDocument workflow:
- Add to README.md workflows section
- Add examples showing usage
- Update workflow guide
Modifying the Delegation Hierarchy
Update handoff protocol:
- Edit
src/framework/shared/handoff-protocol.md - Update delegation authority matrix
- Document new delegation patterns
- Edit
Update agent skills:
- Modify relevant SKILL.md files
- Update delegation instructions
- Update reporting relationships
Test delegation chains:
- Verify new chains work correctly
- Test depth limits still enforced
- Test loop prevention still works
Update architecture docs:
- Update hierarchy diagrams
- Update delegation flow charts
- Update architecture documentation
Extending the Shared Memory Layer
Write tests first:
bash# Add tests to tests/unit/memory/ # Verify new functionalityImplement feature:
typescript// Add to src/memory/ // Follow existing patterns // Maintain type safetyUpdate API docs:
- Document new functions
- Add usage examples
- Update src/memory/README.md
Verify coverage:
bashnpm run test:coverage # Ensure 99%+ coverage maintained
Testing Guidelines
Unit Tests
Unit tests should:
- Test a single function or module
- Be fast (< 100ms per test)
- Not depend on external services
- Use mocks for dependencies
Example:
import { writeMemory } from '../memory/write';
describe('writeMemory', () => {
it('should write memory to file', async () => {
const result = await writeMemory({
agent_id: 'test',
data: { key: 'value' }
});
expect(result.success).toBe(true);
});
});Integration Tests
Integration tests should:
- Test multiple components together
- Verify end-to-end workflows
- Use real files (in test directory)
- Clean up after themselves
Example:
describe('CAD Workflow', () => {
it('should execute complete cycle', async () => {
// Test QA writes tests
// Test Dev implements
// Test QA verifies
// Test Staff Eng reviews
});
});Test Naming
Use descriptive names that explain what is being tested:
// Good
it('should return error when file does not exist')
it('should increment depth when delegating')
it('should prevent circular delegation')
// Bad
it('should work')
it('test function')
it('handles errors')Documentation Standards
Code Comments
Only add comments when code cannot be self-documenting:
// Good - complex algorithm needs explanation
// Use binary search to find insertion point
// Time complexity: O(log n)
const index = binarySearch(arr, target);
// Bad - obvious comment
// Increment counter
counter++;README Updates
When adding features, update README.md with:
- Feature description
- Usage examples
- Configuration options
- Breaking changes (if any)
Documentation Site
This site is built with VitePress. To update:
cd docs
npm run dev # Preview locally
npm run build # Build for productionGetting Help
- Review existing code and tests for patterns
- Check
.claude/shared/directory for protocols and standards - Read the Architecture Guide
- Read the Agent Reference
- Open an issue for questions or clarifications
- Join discussions on GitHub
Code of Conduct
We are committed to providing a welcoming and inclusive environment. Please:
- Be respectful and professional
- Provide constructive feedback
- Focus on the code, not the person
- Help others learn and grow
See our full Code of Conduct.
License
By contributing, you agree that your contributions will be licensed under the same MIT License that covers the project.
Thank you for contributing to miniature-guacamole!
We appreciate your time and effort in making this project better.