4.8 KiB
4.8 KiB
molecule-dev — Molecule AI Codebase Conventions Plugin
molecule-dev is a platform conventions plugin that captures hard-won lessons from Molecule AI's production codebase. Rather than repeating mistakes, every agent working on the platform benefits from rules derived from real bugs and production failures.
Version: 1.0.0
Runtime: claude_code, deepagents, hermes
Repository Layout
molecule-dev/
├── plugin.yaml — Plugin manifest (runtimes, rules, skills)
├── rules/
│ └── codebase-conventions.md — Platform-wide conventions (Canvas/Go/Python)
├── skills/
│ └── review-loop/SKILL.md — Multi-round review orchestration workflow
└── adapters/ — Harness adaptors (thin wrappers)
Conventions Summary
See rules/codebase-conventions.md for the full ruleset. Key highlights:
Canvas (Next.js 15 App Router)
'use client'is non-negotiable — every.tsxfile using React hooks or event handlers must declare it as the very first line.- Zustand selectors: never call a function returning a new object inside a selector — use
useMemoinstead. - Dark zinc theme — backgrounds
zinc-900/zinc-950, textzinc-300/zinc-400. Never use#ffffffor light colors. - Verify API response shapes with
curlor Go handler inspection — don't assume.
Platform (Go)
- SQL safety: always parameterized queries (
$1,$2), alwaysExecContext/QueryContext. - Access control: every workspace endpoint must verify ownership; new A2A proxy paths must pass
CanCommunicate(). - Container lifecycle: use
ContainerRemove(Force: true)— neverContainerStop+ContainerRemoveseparately.
Workspace Runtime (Python)
- Error sanitization: use
sanitize_agent_error()— never emit raw exception messages or subprocess stderr to the user. - System prompt hot-reload: always use
encoding="utf-8", errors="replace"when reading prompt files.
Development
Prerequisites
- Node.js >= 18 (for markdownlint)
- Python 3.11+ (for
adapters/) ghCLI authenticated- Write access to
Molecule-AI/molecule-ai-plugin-molecule-dev
Setup
git clone https://github.com/Molecule-AI/molecule-ai-plugin-molecule-dev.git
cd molecule-ai-plugin-molecule-dev
# Install markdownlint CLI for pre-commit linting
npm install -g markdownlint-cli
# Validate the plugin structure
gh workflow run validate-plugin.yml --ref main
Adapter Dev
python3 -m venv .venv && source .venv/bin/activate
pip install plugins_registry
python -c "from adapters.claude_code import Adaptor; print('OK')"
Pre-Commit Checklist
# Markdown lint
npx markdownlint '**/*.md' --ignore node_modules
# YAML validation
python3 -c "import yaml; yaml.safe_load(open('plugin.yaml'))"
# No pycache committed
find . -name '__pycache__' -o -name '*.pyc' | grep -v .gitignore && exit 1
Test Commands
There are no unit tests in this plugin — it is a configuration-only package. Validation is done by the shared validate-plugin.yml workflow (see CI).
To run validation locally:
gh workflow run validate-plugin.yml --ref main
To validate plugin.yaml structure:
python3 -c "
import yaml, os
with open('plugin.yaml') as f:
data = yaml.safe_load(f)
for key in ['rules', 'skills']:
for ref in data.get(key, []):
path = ref if ref.endswith('.md') else ref + '.md'
print(f'[OK] {path}' if os.path.exists(path) else f'[MISSING] {path}')
"
Release Process
- Review changes —
git log origin/main..HEAD --oneline - Validate — run
npx markdownlinton all.mdfiles - Bump version in
plugin.yaml - Commit —
chore: bump version to X.Y.Z - Tag —
git tag -a vX.Y.Z -m "Release vX.Y.Z"and push - Create GitHub Release with a changelog section
- Verify CI green on the release commit
Key Contacts
| Role | Owner |
|---|---|
| Platform architecture (Go/Canvas) | Molecule AI Engineering |
| Workspace runtime (Python) | Molecule AI Engineering |
| Plugin maintenance | Molecule AI Engineering |
For questions, bugs, or suggestions, open an issue in this repo or reach out via the Molecule AI internal channels.
Adding a New Convention
- Create
rules/<rule-name>.mddescribing the convention. - Add it to
rules:inplugin.yaml(and addrules/section if not present). - If it affects canvas work, include a concrete code example (BAD / GOOD pattern).
- Run markdownlint validation before committing.
Adding a New Skill
- Create
skills/<skill-name>/SKILL.mdwith YAML frontmatter (name,description). - Add it to
skills:inplugin.yaml. - Skills are the canonical workflow surface — prefer skills over commands.