codify

package module
v1.7.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README ΒΆ

🧠 Codify

Version MCP Go License Claude Gemini AGENTS.md

Give your AI agent the master blueprint it needs before writing the first line of code πŸ—οΈ

Because an agent without context is an intern with root access.

[English] | EspaΓ±ol

Quick Start Β· MCP Server Β· Features Β· Skills Β· Language Guides Β· Presets Β· Architecture


🎯 The Problem

You tell your agent: "Build a payments API in Go with microservices"

And the agent, with all its capability, improvises:

  • Folder structures nobody asked for
  • Patterns that contradict your architecture
  • Decisions you'll revert in the next session
  • Zero continuity between sessions

It's not the agent's fault. It starts from scratch. Every. Single. Time. πŸ”„

πŸ’‘ The Solution

Codify takes your project description and generates intelligent context files using LLMs (Anthropic Claude or Google Gemini). Files that give your agent the master blueprint, domain constraints, and architectural memory it needs.

It follows the AGENTS.md standard β€” an open specification backed by the Linux Foundation for providing AI agents with project context. This means the files work out of the box with Claude Code, Cursor, Codex, and any agent that reads the standard.

🧭 AI Spec-Driven Development

This tool enables a methodology we call AI Spec-Driven Development (AI SDD): instead of going straight from an idea to code, you first generate a rich specification layer that grounds your agent's work.

Your idea β†’ generate (context) β†’ spec (specifications) β†’ Agent writes code with full context

The generate command creates the architectural blueprint β€” what the project is, how it's built, what patterns it follows. The spec command takes that blueprint and produces implementation-ready specifications β€” features, acceptance criteria, technical plans, and task breakdowns.

Your agent doesn't improvise. It implements a spec. That's the difference.

✨ Before and after

😱 Without context (the current reality)
You: "Create a payments API in Go"

Agent: *creates main.go with everything in one file*
You: "No, use Clean Architecture"
Agent: *creates structure but mixes domain with infra*
You: "Repositories go in infrastructure"
Agent: *refactors for the third time*
You: "What about the BDD tests I asked for yesterday?"
Agent: "BDD tests? This is the first time you've mentioned that"

Result: 45 minutes correcting the agent 😀
πŸš€ With Codify
You: "Create a payments API in Go"

Agent: *reads AGENTS.md, CONTEXT.md, DEVELOPMENT_GUIDE.md and IDIOMS.md*
Agent: "I see you use DDD with Clean Architecture, PostgreSQL,
        BDD testing with Godog, and idiomatic Go patterns.
        I'll create the payments endpoint in internal/domain/payment/
        following your patterns and concurrency conventions."

Result: Coherent code from the first line ✨

⚑ Quick Start

Installation
# Homebrew (macOS/Linux β€” no Go required)
brew tap jorelcb/tap
brew install codify

# Or via go install
go install github.com/jorelcb/codify/cmd/codify@latest

# Or download pre-built binaries from GitHub Releases
# https://github.com/jorelcb/codify/releases
Your first context in 30 seconds
# 1. Set your API key (Claude or Gemini)
export ANTHROPIC_API_KEY="sk-ant-..."   # for Claude (default)
# or
export GEMINI_API_KEY="AI..."           # for Gemini

# 2. Describe your project (with language for idiomatic guides)
codify generate payment-service \
  --description "Payment microservice in Go with gRPC, PostgreSQL and Kafka. \
  DDD with Clean Architecture. Stripe as payment processor." \
  --language go

# 3. Use Gemini instead of Claude
codify generate payment-service \
  --description "Payment microservice in Go" \
  --model gemini-3.1-pro-preview

# 4. Done. Files generated.
What you'll see
πŸš€ Generating context for: payment-service
  Model: claude-sonnet-4-6
  Preset: default
  Language: go

  [1/5] Generating AGENTS.md... βœ“
  [2/5] Generating CONTEXT.md... βœ“
  [3/5] Generating INTERACTIONS_LOG.md... βœ“
  [4/5] Generating DEVELOPMENT_GUIDE.md... βœ“
  [5/5] Generating IDIOMS.md... βœ“

πŸ“ Output: output/payment-service/
  β”œβ”€β”€ AGENTS.md                β†’ Root file (tech stack, commands, conventions)
  └── context/
      β”œβ”€β”€ CONTEXT.md           β†’ Architecture and technical design
      β”œβ”€β”€ INTERACTIONS_LOG.md  β†’ Session log and ADRs
      β”œβ”€β”€ DEVELOPMENT_GUIDE.md β†’ Work methodology, testing, security
      └── IDIOMS.md            β†’ Language-specific patterns (Go)

βœ… Done! 5 files generated
   Total tokens: ~18,200

πŸ”Œ MCP Server

Use Codify as an MCP server β€” your AI coding agent calls the tools directly, no manual CLI needed.

Install
go install github.com/jorelcb/codify/cmd/codify@latest
Claude Code

Add to your project's .mcp.json:

{
  "mcpServers": {
    "codify": {
      "command": "codify",
      "args": ["serve"],
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-...",
        "GEMINI_API_KEY": "AI..."
      }
    }
  }
}
Codex CLI
# Register the MCP server
codex mcp add codify -- codify serve
Gemini CLI

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "codify": {
      "command": "codify",
      "args": ["serve"],
      "env": {
        "GEMINI_API_KEY": "AI..."
      }
    }
  }
}

Set the API key(s) for the provider(s) you want to use. The provider is auto-detected from the model parameter. If the binary is not in your PATH, use the full path (e.g., /Users/you/go/bin/codify).

Available MCP Tools
Generative tools (require LLM API key)
Tool Description
generate_context Generate context files from a project description
generate_specs Generate SDD specs from existing context files
analyze_project Scan an existing project and generate context from its structure
generate_skills Generate reusable Agent Skills based on architectural presets

All generative tools support locale (en/es), model, and preset parameters. generate_context and analyze_project also accept with_specs to chain spec generation automatically.

Knowledge tools (no API key needed)
Tool Description
commit_guidance Conventional Commits spec and behavioral context for generating proper commit messages
version_guidance Semantic Versioning spec and behavioral context for determining version bumps

Knowledge tools inject behavioral context into the calling agent β€” the same way a Claude Code agent would. The agent receives the spec and instructions, then applies them to the current task. Supports locale (en/es).

Example prompts
"Generate context for a payment microservice in Go with gRPC and PostgreSQL"
β†’ Agent calls generate_context

"Analyze my project at /path/to/my-app and generate specs"
β†’ Agent calls analyze_project with with_specs=true

"Help me commit these changes following conventional commits"
β†’ Agent calls commit_guidance, receives the spec, crafts the message

"What version should I release based on recent changes?"
β†’ Agent calls version_guidance, receives semver rules, analyzes commits

🎨 Features

πŸ“‹ generate command β€” Context for your agent

Generates files following the AGENTS.md standard:

File What it does
AGENTS.md Root file: tech stack, commands, conventions, structure
CONTEXT.md Architecture, components, data flow, design decisions
INTERACTIONS_LOG.md Session log and ADRs
DEVELOPMENT_GUIDE.md Work methodology, testing practices, security, delivery expectations
IDIOMS.md Language-specific concurrency, error handling, conventions (requires --language)

Place these files at your project root. Compatible agents (Claude Code, Cursor, Codex, etc.) read them automatically.

πŸ“ spec command β€” AI SDD specifications

From existing context, generates technical specifications ready for implementation:

codify spec payment-service \
  --from-context ./output/payment-service/
File What it does
CONSTITUTION.md Project DNA: stack, principles, constraints
SPEC.md Feature specs with acceptance criteria
PLAN.md Technical design and architecture decisions
TASKS.md Task breakdown with dependencies and priority
πŸ”Ž analyze command β€” Context from existing projects

Scans an existing codebase and generates context files automatically:

codify analyze /path/to/my-project --with-specs

Auto-detects language, framework, dependencies, directory structure, README, existing context files, and infrastructure signals (Docker, CI/CD, Makefile, etc.). Everything feeds into the LLM for richer, project-aware generation.

⚑ --with-specs β€” Full pipeline in one command

Available on both generate and analyze. Chains context generation + spec generation + AGENTS.md update in a single run:

codify generate my-api \
  --description "REST API in Go with PostgreSQL" \
  --language go \
  --with-specs
🧩 skills command β€” Agent Skills

Generates reusable Agent Skills (SKILL.md) based on architectural presets. Skills are cross-project β€” install them globally and any AI agent will use them when relevant.

# Default preset: DDD, Clean Arch, BDD, CQRS, Hexagonal
codify skills

# Neutral preset for Codex
codify skills --preset neutral --target codex

# For Antigravity IDE in Spanish
codify skills --target antigravity --locale es
Preset Skills generated
default DDD entity, Clean Architecture layer, BDD scenario, CQRS command, Hexagonal port/adapter
neutral Code review, test strategy, safe refactoring, API design
workflow Conventional commits, semantic versioning

Target ecosystems: claude (default), codex, antigravity β€” each gets ecosystem-specific YAML frontmatter and output path (.claude/skills/, .agents/skills/).

πŸ” list command β€” Generated projects
codify list

🌐 Language-Specific Guides

When you pass --language, the tool generates an additional IDIOMS.md file with patterns and conventions specific to that language. This is one of the most impactful features β€” it gives your agent deep knowledge of idiomatic patterns instead of generic advice.

Language What IDIOMS.md covers
go Goroutines, channels, WaitGroups, context.Context, error wrapping with %w, table-driven tests
javascript async/await, Promise.all, AbortController, worker threads, TypeScript, ESM, Jest patterns
python asyncio, multiprocessing, type hints, pydantic, pytest fixtures, ruff
# Go project with idiomatic guides
codify generate my-api -d "REST API in Go" --language go

# TypeScript SDK with JS idioms
codify generate my-sdk -d "SDK in TypeScript" --language javascript

# Python service with async patterns
codify generate my-service -d "FastAPI service" --language python

Without --language, the tool generates 4 files. With it, you get 5 β€” and significantly richer output.

🎭 Presets

Choose the philosophy for your contexts:

--preset default (default)

Recommended: DDD + Clean Architecture + BDD. Includes:

  • Strict layer separation (Domain β†’ Application β†’ Infrastructure β†’ Interfaces)
  • BDD testing with coverage targets (80% domain, 70% application)
  • OpenTelemetry observability
  • Mandatory dependency injection
  • MUST/MUST NOT constraints
  • Development methodology and self-validation checklist
codify generate my-api \
  --description "Inventory management REST API in Go"
# Uses default preset automatically
--preset neutral

No architectural stance. Lets the LLM adapt the structure to the project:

codify generate my-api \
  --description "Inventory management REST API in Go" \
  --preset neutral
--from-file β€” Rich descriptions from files

For detailed project descriptions (design docs, RFCs, 6-pagers), use --from-file instead of --description:

codify generate my-api \
  --from-file ./docs/project-description.md \
  --language go

The file content becomes the project description. Supports any text format β€” markdown, plain text, etc. Mutually exclusive with --description.

βš™οΈ Options

codify generate <name> [flags]
Flag Short Description Default
--description -d Project description (required unless --from-file) β€”
--from-file -f Read description from file (alternative to -d) β€”
--preset -p Template preset default
--model -m LLM model (claude-* or gemini-*) claude-sonnet-4-6
--language -l Language (activates idiomatic guides) β€”
--locale Output language (en, es) en
--with-specs Also generate SDD specs after context false
--type -t Project type hint (api, cli, lib...) β€”
--architecture -a Architecture hint β€”

πŸ—οΈ Architecture

Built in Go with what it preaches β€” DDD/Clean Architecture:

internal/
β”œβ”€β”€ domain/              πŸ’Ž Pure business logic
β”‚   β”œβ”€β”€ project/         Project entity (aggregate root)
β”‚   β”œβ”€β”€ shared/          Value objects, domain errors
β”‚   └── service/         Interfaces: LLMProvider, FileWriter, TemplateLoader
β”‚
β”œβ”€β”€ application/         πŸ”„ Use cases (CQRS)
β”‚   β”œβ”€β”€ command/         GenerateContext, GenerateSpec
β”‚   └── query/           ListProjects
β”‚
β”œβ”€β”€ infrastructure/      πŸ”§ Implementations
β”‚   β”œβ”€β”€ llm/             LLM providers (Claude, Gemini) + prompt builder
β”‚   β”œβ”€β”€ template/        Template loader (locale + preset + language-aware)
β”‚   β”œβ”€β”€ scanner/         Project scanner (language, deps, framework detection)
β”‚   └── filesystem/      File writer, directory manager, context reader
β”‚
└── interfaces/          🎯 Entry points
    β”œβ”€β”€ cli/commands/    generate, analyze, spec, skills, serve, list
    └── mcp/             MCP server (stdio + HTTP transport, 4 tools)
Template system
templates/
β”œβ”€β”€ en/                          English locale
β”‚   β”œβ”€β”€ default/                 Recommended preset (DDD/Clean Architecture)
β”‚   β”‚   β”œβ”€β”€ agents.template
β”‚   β”‚   β”œβ”€β”€ context.template
β”‚   β”‚   β”œβ”€β”€ interactions.template
β”‚   β”‚   └── development_guide.template
β”‚   β”œβ”€β”€ neutral/                 Generic preset (no architectural opinions)
β”‚   β”‚   └── (same files)
β”‚   β”œβ”€β”€ spec/                    Specification templates (AI SDD)
β”‚   β”‚   β”œβ”€β”€ constitution.template
β”‚   β”‚   β”œβ”€β”€ spec.template
β”‚   β”‚   β”œβ”€β”€ plan.template
β”‚   β”‚   └── tasks.template
β”‚   β”œβ”€β”€ skills/                  Agent Skills templates
β”‚   β”‚   β”œβ”€β”€ default/             DDD, Clean Arch, BDD, CQRS, Hexagonal
β”‚   β”‚   └── neutral/             Code review, testing, refactoring, API design
β”‚   └── languages/               Language-specific idiomatic guides
β”‚       β”œβ”€β”€ go/idioms.template
β”‚       β”œβ”€β”€ javascript/idioms.template
β”‚       └── python/idioms.template
└── es/                          Spanish locale (same structure)

The golden rule: Infrastructure β†’ Application β†’ Domain. Nothing in domain depends on anything external.

See context/CONTEXT.md for full architectural details.

πŸ§ͺ Tests

# All tests
go test ./...

# BDD with Godog
go test ./tests/...

πŸ“Š Project status

v1.4.0 πŸŽ‰

βœ… Working:

  • Multi-provider LLM support (Anthropic Claude + Google Gemini)
  • Context generation with streaming
  • SDD spec generation from existing context
  • Agent Skills generation (SKILL.md) for Claude Code, Codex, Antigravity
  • MCP Server mode (stdio + HTTP transport)
  • analyze command β€” scan existing projects and generate context
  • --with-specs flag β€” full pipeline in one command
  • Preset system (default DDD/BDD, neutral)
  • AGENTS.md standard as root file
  • Language-specific idiomatic guides (Go, JavaScript, Python)
  • Anti-hallucination grounding rules in prompts
  • CLI with Cobra (generate, analyze, spec, skills, serve, list)

🚧 Coming next:

  • End-to-end integration tests
  • Retries and rate limit handling
  • Interactive mode (wizard)
  • MCP server authentication (OAuth/BYOK for remote deployments)

πŸ’‘ FAQ

Which LLM providers are supported? Anthropic Claude (default) and Google Gemini. Set ANTHROPIC_API_KEY for Claude or GEMINI_API_KEY for Gemini. The provider is auto-detected from the --model flag: claude-* models use Anthropic, gemini-* models use Google.

How much does each generation cost? 4-5 API calls for generate (depending on --language), 4 for spec. Each generation costs pennies with either provider.

Are the templates fixed? They're structural guides, not renderable output. The LLM generates intelligent, project-specific content following the template structure.

Can I customize the templates? You can create your own presets in templates/<locale>/. Each preset needs 4 files: agents.template, context.template, interactions.template, and development_guide.template. Language-specific templates go in templates/<locale>/languages/<lang>/idioms.template.

Which agents support the generated files? Any agent compatible with the AGENTS.md standard: Claude Code, Cursor, GitHub Copilot Workspace, Codex, and more.

What's AI Spec-Driven Development? A methodology where you generate context and specifications before writing code. Your agent implements a spec, not an improvisation. generate creates the blueprint, spec creates the implementation plan.

πŸ“š Documentation

πŸ“„ License

Apache License 2.0 β€” see LICENSE.


Built to supercharge AI-assisted development 🧠

"An agent without context is an intern with root access"

⭐ If this helped you, give it a star β€” it keeps us building

πŸ› Report bug Β· πŸ’‘ Request feature

Documentation ΒΆ

Index ΒΆ

Constants ΒΆ

This section is empty.

Variables ΒΆ

View Source
var TemplatesFS embed.FS

Functions ΒΆ

This section is empty.

Types ΒΆ

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL