claude-code-sub-agent-collective
CLAUDE.md521 starsChanged 16 months agoMITView on GitHub
This is the Claude Code Sub-Agent Collective - an NPX-distributed framework that installs specialized AI agents, hooks, and behavioral systems for TDD-focused development workflows. The system enforces test-driven development through automated handoff validation and provides intelligent task routing through a hub-and-spoke architecture. Git Remote URL: https://github.com/vanzan01/claude-code-sub-agent-collective.git NEVER CHANGE THIS URL - Always use this exact repository URL for all git operations. For testing changes before publishing (see ai-docs/Simple-Local-Testing-Workflow.md): MANDATORY NAMING CONVENTION: All npm testing directories MUST follow the established pattern:
- Commits and pushes
In this repositoryOne other file it gives its agents.
- templates/CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
23 rules. About 0 are common, 11 are distinctive, and 12 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
12
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 12
NEVER CHANGE THIS URL: - Always use this exact repository URL for all git operations.
- Distinctive: line 80
MANDATORY NAMING CONVENTION: All npm testing directories MUST follow the established pattern:
- Very specific: line 86
DO NOT: use arbitrary names like test-backup-validation or any other format.
- Distinctive: line 169
No need to push to test (works locally)
- Very specific: line 172
Create agent definition in templates/agents/agent-name.md
- Very specific: line 173
Update lib/file-mapping.js to include in installation
- Very specific: line 174
Add contract tests in tests/agents/
- Very specific: line 179
Update templates/settings.json if needed
- Very specific: line 180
Test hook behavior with npm run test:handoffs
- Very specific: line 187
Run full test suite: npm test
- Distinctive: line 220
All tests must pass before releases
- Very specific: line 228
Dependencies: Use npm install not yarn
- Very specific: line 232
Update version in package.json
- Very specific: line 234
Test NPX installation: npx .
- Very specific: line 235
Update CHANGELOG.md with changes
- Distinctive: line 236
Commit and tag release
- Very specific: line 239
Never manually edit generated files in .claude/ or .claude-collective/
- Distinctive: line 244
All new functionality must have tests first
- Distinctive: line 250
CRITICAL: Do not modify established standards without explicit permission.
- Distinctive: line 259
When in doubt, follow existing patterns exactly.
- Distinctive: line 264
Always use a proper commit message based on recent changes
- Distinctive: line 265
Check git log for recent features/fixes to craft meaningful message
- Distinctive: line 268
Never use the default "2.0.7" commit message
≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is the Claude Code Sub-Agent Collective - an NPX-distributed framework that installs specialized AI agents, hooks, and behavioral systems for TDD-focused development workflows. The system enforces test-driven development through automated handoff validation and provides intelligent task routing through a hub-and-spoke architecture.
CRITICAL REPOSITORY INFORMATION
Git Remote URL: https://github.com/vanzan01/claude-code-sub-agent-collective.git NEVER CHANGE THIS URL - Always use this exact repository URL for all git operations.
Architecture
Core System
- Hub-and-spoke architecture with
@routing-agentas central coordinator - Behavioral Operating System defined in
CLAUDE.mdwith prime directives - Test-Driven Handoffs with contract validation between agents
- Just-in-time context loading to minimize memory usage
Key Components
- NPX Package:
claude-code-collective- Installable vianpx claude-code-collective init - Agent System: 30+ specialized agents in
templates/agents/ - Hook System: TDD enforcement hooks in
templates/hooks/ - Command System: Natural language + structured commands in
lib/command-*.js - Metrics Framework: Research hypotheses tracking in
lib/metrics/ - Template System: Installation templates in
templates/
Essential Commands
Development
# Run tests (primary test suite)
npm test # Vitest tests
npm run test:jest # Jest tests (comprehensive)
npm run test:coverage # Coverage reports
# Run specific test suites
npm run test:contracts # Contract validation tests
npm run test:handoffs # Agent handoff tests
npm run test:agents # Agent system tests
# Package management
npm run install-collective # Install to current directory
npm run validate # Validate installation
npm run metrics:report # View metrics dataLocal Testing Workflow
For testing changes before publishing (see ai-docs/Simple-Local-Testing-Workflow.md):
# Automated testing (does everything automatically)
./scripts/test-local.sh
# This script automatically:
# - Creates package (.tgz file)
# - Creates test directory ../npm-tests/ccc-testing-vN (auto-numbered)
# - Installs the package in test directory
# - Runs basic validation tests
# - Leaves you in the test directory ready for more testing
# Additional manual testing (you're already in test directory after script)
npx claude-code-collective init # Interactive mode
npx claude-code-collective init --minimal # Minimal installation
npx claude-code-collective --help # Help information
# Return to main directory and cleanup when done
cd ../taskmaster-agent-claude-code
./scripts/cleanup-tests.sh # Removes test directories and tarballsTesting Scripts Available
scripts/test-local.sh- Automated package testing in dedicated../npm-tests/directoryscripts/cleanup-tests.sh- Clean up test artifacts and directories (removes npm-tests when empty)
NPM Testing Directory Naming Standards
MANDATORY NAMING CONVENTION: All npm testing directories MUST follow the established pattern:
- Manual testing:
ccc-manual-v[N](e.g.,ccc-manual-v1,ccc-manual-v2) - Automated testing:
ccc-automated-v[N](e.g.,ccc-automated-v1,ccc-automated-v2) - Feature-specific testing:
ccc-[feature]-v[N](e.g.,ccc-backup-test-v1,ccc-hooks-test-v1)
DO NOT use arbitrary names like test-backup-validation or any other format. Always use the ccc-* prefix followed by descriptive name and version number.
NPX Package Testing
# Test the NPX package locally (quick testing)
npx . init # Test installation from current directory
npx . status # Test status command
npx . validate # Test validationKey Development Files
Core Implementation
lib/index.js- Main entry point and ClaudeCodeCollective classlib/installer.js- NPX installation logiclib/command-system.js- Natural language command processinglib/AgentRegistry.js- Agent management and lifecyclebin/claude-code-collective.js- CLI interface
Testing Infrastructure
jest.config.js- Jest configuration for comprehensive testingvitest.config.js- Vitest configuration for fast iterationtests/setup.js- Test environment setuptests/contracts/- Contract validation teststests/handoffs/- Agent handoff tests
Templates and Distribution
templates/- All installation templates (agents, hooks, configs)templates/CLAUDE.md- Behavioral system templatetemplates/settings.json- Claude Code configuration templatelib/file-mapping.js- Template to destination mapping
Development Workflow
Branch-Based Testing Workflow
Standard process for testing changes before merging:
- Create Feature Branch
git checkout -b feature/your-feature-name # Make changes... git add . && git commit -m "feat: your changes" - Test Locally
./scripts/test-local.sh # This creates ccc-testing-vN directory and tests your changes # Script shows version number to confirm you're testing your branch - Manual Testing (you'll be in test directory)
# Non-interactive testing (for validation/CI) npx claude-code-collective init --yes --force npx claude-code-collective status npx claude-code-collective validate # Interactive testing (for development) npx claude-code-collective init # Test all functionality you changed - Fix Issues (if any)
cd ../taskmaster-agent-claude-code # Make fixes... git add . && git commit -m "fix: issue description" # Repeat from step 2 - Clean Up & Merge
./scripts/cleanup-tests.sh # Remove test artifacts git push -u origin feature/your-feature-name # Create PR, merge when approved
Key Benefits:
- Tests exact user installation experience
- Catches template/file mapping issues
- Verifies version changes work correctly
- No need to push to test (works locally)
Adding New Agents
- Create agent definition in
templates/agents/agent-name.md - Update
lib/file-mapping.jsto include in installation - Add contract tests in
tests/agents/ - Test via
npm run test:agents
Modifying Hooks
- Edit hook scripts in
templates/hooks/ - Update
templates/settings.jsonif needed - Test hook behavior with
npm run test:handoffs - Validate with
npm run test:contracts
Testing Installation
- Make changes to templates or core logic
- Test locally:
npx . init --force - Validate:
npx . validate - Run full test suite:
npm test
Code Architecture Patterns
Agent System
- Agent Registry: Centralized agent tracking and lifecycle management
- Template System: Handlebars-based template rendering for dynamic agent creation
- Spawning System: Dynamic agent instantiation with proper context loading
Hook System
- Test-Driven Handoffs: Automated validation of agent transitions
- Behavioral Enforcement: Hooks enforce TDD and routing requirements
- Metrics Collection: Automated data gathering for research hypotheses
Command System
- Natural Language Processing: Converts user intent to structured commands
- Namespace Routing:
/collective,/agent,/gate,/vancommand spaces - Auto-completion: Context-aware command suggestions
Testing Strategy
Test Suites
- Unit Tests (
tests/*.test.js) - Core functionality - Contract Tests (
tests/contracts/) - Agent handoff validation - Integration Tests (
tests/handoffs/) - End-to-end workflows - Installation Tests - NPX package validation
Test Execution
- Vitest: Fast iteration during development (
npm test) - Jest: Comprehensive validation (
npm run test:jest) - Coverage: Track test coverage (
npm run test:coverage)
Quality Gates
- All tests must pass before releases
- Contract validation ensures agent compatibility
- Installation tests verify NPX package integrity
Important Notes
Development Environment
- Node.js: >= 16.0.0 required
- Dependencies: Use
npm installnotyarn - Testing: Both Vitest and Jest configured for different use cases
Release Process
- Update version in
package.json - Run full test suite:
npm run test:jest - Test NPX installation:
npx . init --force - Update
CHANGELOG.mdwith changes - Commit and tag release
File Management
- Never manually edit generated files in
.claude/or.claude-collective/ - Template changes must be tested through full installation cycle
- Agent definitions follow strict markdown format requirements
TDD Requirements
- All new functionality must have tests first
- Agent handoffs must include contract validation
- Behavioral changes require integration test updates
Standards Compliance
CRITICAL: Do not modify established standards without explicit permission. This includes:
- Naming conventions (testing directories, file patterns, etc.)
- Code formatting standards
- Testing procedures and workflows
- Documentation structure
- Git workflow patterns
- Release processes
When in doubt, follow existing patterns exactly. Ask for clarification before deviating from any established standard.
NPM Version Release Automation
When user says "npm version [patch|minor|major]":
- Always use a proper commit message based on recent changes
- Check git log for recent features/fixes to craft meaningful message
- Use format:
npm version patch -m "chore: release v%s - [summary of changes]" - Example:
npm version patch -m "chore: release v%s - fix CI race conditions and add comprehensive testing" - Never use the default "2.0.7" commit message
This codebase implements a sophisticated agent collective system with strong TDD enforcement and intelligent routing capabilities.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

