@xenonbyte/constraint-generator
v1.3.7
Published
Generate and manage AI programming assistant constraint files (CLAUDE.md, AGENTS.md, GEMINI.md)
Maintainers
Readme
Constraint Generator
Generate and maintain AI assistant constraint files (CLAUDE.md, AGENTS.md, GEMINI.md) from one shared model.
Current version: 1.3.7
Platform Mapping
| Platform | Constraint File | In-Tool Prefix |
|----------|------------------|----------------|
| Claude Code | CLAUDE.md | /cg:<command> |
| Codex | AGENTS.md | /prompts:cg-<command> |
| Gemini | GEMINI.md | /cg:<command> |
Command Channels
Constraint Generator has two explicit command channels:
- In-tool skills (
/cg:*,/prompts:cg-*) - Local CLI (
cg ...)
In-Tool Skill Commands (Quick Reference)
| Command | Key Parameters |
|---------|----------------|
| /cg:generate | --tier <mvp\|full>, --platforms, --dry-run, --rules, --quality |
| /cg:guided | --resume |
| /cg:update | --strategy, --platforms, --dry-run, --no-backup, --force |
| /cg:drift | --platforms, --exit-code |
| /cg:refs | actions: check, list |
| /cg:status | no parameters |
| /cg:monorepo | --platforms, --package, --exclude, --dry-run |
| /cg:help | no parameters |
Codex equivalents use /prompts:cg-... (for example /prompts:cg-help).
Local CLI Commands (Quick Reference)
cg ... are local terminal commands.
Constraint generation is skill-only (use /cg:generate or /prompts:cg-generate).
cg claude ... remain Claude-only local settings workflows (not in-tool /cg: skill commands).
| Command | Key Parameters |
|---------|----------------|
| cg install | --platform/--platforms, --workspace, --dry-run, --force, --no-seed |
| cg uninstall | --platform/--platforms or --all, --workspace, --remove-seed, --dry-run |
| cg claude protect | --pattern (required, repeatable), --scope, --level, --strict-sandbox, --dry-run |
| cg claude mode | --mode (required), --scope, --yes-dangerous, --dry-run |
| cg claude hooks suggest | --scope, --dry-run |
| cg claude hooks apply | --scope, --dry-run |
| cg --help | no parameters |
Full parameter reference: Command Reference
Core Generation Semantics
Template Tiers
mvpincludes:roleprinciplestech-stackforbiddenverificationcompact-instructions
fullincludesmvpplus:workflowscode-styleerror-handlingreferences(when reference inputs exist)
output-format and quality are not part of default AI-facing tier composition.
--quality Behavior
--quality remains supported as a generation/runtime policy control (fast, balanced, strict, etc.). It does not require rendering a root quality section.
--rules Boundary (Claude-only mechanism)
--rules is scoped to the Claude adapter:
- Claude output may split
path-scopedsections into.claude/rules/*.md - Codex/Gemini outputs keep full single-file content
- If Claude is not in targets, no
.claude/rules/files are created
Future Codex/Gemini local-rule layering requires dedicated platform-native adapters and is not implemented in this release.
AI-Facing Output Language
Generated governance artifacts intended for model/runtime consumption are always English, including:
CLAUDE.md/AGENTS.md/GEMINI.md.claude/rules/*.md- Claude hooks proposal/config snippets generated by cg
Metadata Sidecar (Token Optimization)
Generated constraint files keep model-facing content lean and store generator metadata in sidecar files:
.cg/metadata/CLAUDE.md.meta.json.cg/metadata/AGENTS.md.meta.json.cg/metadata/GEMINI.md.meta.json
cg uses sidecars for round-trip parsing and drift/consistency workflows.
Root .gitignore is auto-updated to include .cg/.
Claude Project Settings Workflows
Protect Sensitive Paths
cg claude protect --pattern '**/.env' --level sealed --scope project- Writes to
.claude/settings.json(or.claude/settings.local.jsonfor--scope local) - Merges non-destructively and deduplicates rules
- Protect commands only append/tighten rules (no silent weakening)
Configure Default Mode
cg claude mode --mode plan --scope projectFor dangerous mode:
cg claude mode --mode bypassPermissions --yes-dangerousbypassPermissionsrequires explicit dangerous confirmation- deny-based protections still apply
- governance setting
permissions.disableBypassPermissionsMode=trueblocks bypass mode
Claude Hooks Suggest/Apply Workflow
cg claude hooks suggest --scope project
# review .claude/hooks.proposed.jsonc
# remove review marker
cg claude hooks apply --scope projectsuggestonly creates a review-gated proposal fileapplyrequires marker removal, merges hooks non-destructively, and deletes consumed proposal file
Install
One-time setup (recommended):
npx -y @xenonbyte/constraint-generator@latest install --platforms claude,codex,geminiNote: npx is ephemeral and does not install persistent cg to PATH.
Global CLI install (optional):
npm i -g @xenonbyte/constraint-generator
cg install --platforms claude,codex,geminiGit clone + script (fallback):
git clone https://github.com/xenonbyte/constraint-generator.git
cd constraint-generator
./install.sh --platforms claude,codex,geminiUninstall:
cg uninstall --all --remove-seed --workspace .Development
npm install
npm run build
npm test -- --runInBandDocs
License
MIT
